Logback doesn't support half hour file rolling directly.
So I implement
my own FNATP (File Naming And Triggering Policy) and RollingCalendar as follows:
https://github.com/izeye/samples-spring-boot-branches/tree/logback
Note that the implementation is for half minute to test easily.
You can easily change it for half hour.
I wonder why there's no accessor
for `TimeBasedRollingPolicy`'s `fileNamePattern` and `fileNamePatternWCS`.
I have to do reflection hacks because they are package-private.
I tested a little but not fully so you have to check it before using it in production.
Note I didn't copy separate active file related stuff fully for clarity.
If you need it, you can easily add it as follows:
https://github.com/qos-ch/logback/blob/master/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicyBase.java#L59-L64
If there's any bug, please let me know.
Reference:
http://logback.qos.ch/manual/appenders.html
Sunday, March 29, 2015
Thursday, March 26, 2015
Aggregate columns in multiple rows into a single column in Oracle
To aggregate columns in multiple rows into a single column in Oracle,
use `LISTAGG` function as follows:
SELECT LISTAGG(id, ',') WITHIN GROUP (ORDER BY id) FROM tb_person WHERE first_name = 'Johnny';
Reference:
https://docs.oracle.com/database/121/SQLRF/functions100.htm#SQLRF30030
use `LISTAGG` function as follows:
SELECT LISTAGG(id, ',') WITHIN GROUP (ORDER BY id) FROM tb_person WHERE first_name = 'Johnny';
Reference:
https://docs.oracle.com/database/121/SQLRF/functions100.htm#SQLRF30030
Low resolution problem in MacBook Pro when you log in.
You could encounter low resolution problem in MacBook Pro
when you log in like after connecting to a projector.
Then, try to reset NVRAM (non-volatile random-access memory) as follows:
1. Shut down your Mac.
2. Locate the following keys on the keyboard: Command (⌘), Option, P, and R.
3. Turn on your Mac.
4. Press and hold the Command-Option-P-R keys immediately after you hear the startup sound.
5. Hold these keys until the computer restarts and you hear the startup sound for a second time.
6. Release the keys.
References:
https://discussions.apple.com/thread/2353284
https://support.apple.com/en-us/HT204063
when you log in like after connecting to a projector.
Then, try to reset NVRAM (non-volatile random-access memory) as follows:
1. Shut down your Mac.
2. Locate the following keys on the keyboard: Command (⌘), Option, P, and R.
3. Turn on your Mac.
4. Press and hold the Command-Option-P-R keys immediately after you hear the startup sound.
5. Hold these keys until the computer restarts and you hear the startup sound for a second time.
6. Release the keys.
References:
https://discussions.apple.com/thread/2353284
https://support.apple.com/en-us/HT204063
Wednesday, March 11, 2015
Caused by: java.security.cert.CertificateException: No subject alternative names present
When you try to make an HTTPS connection with an unmatched CN (Common Name),
you will get the following exception:
Caused by: java.security.cert.CertificateException: No subject alternative names present
It is not a usual case
but in some case like monitoring, it could be necessary.
You can work around it as follows:
HostnameVerifier hostnameVerifier = new HostnameVerifier() {
@Override
public boolean verify(String s, SSLSession sslSession) {
return true;
}
};
HttpsURLConnection.setDefaultHostnameVerifier(hostnameVerifier);
Reference:
http://stackoverflow.com/questions/10258101/sslhandshakeexception-no-subject-alternative-names-present
you will get the following exception:
Caused by: java.security.cert.CertificateException: No subject alternative names present
It is not a usual case
but in some case like monitoring, it could be necessary.
You can work around it as follows:
HostnameVerifier hostnameVerifier = new HostnameVerifier() {
@Override
public boolean verify(String s, SSLSession sslSession) {
return true;
}
};
HttpsURLConnection.setDefaultHostnameVerifier(hostnameVerifier);
Reference:
http://stackoverflow.com/questions/10258101/sslhandshakeexception-no-subject-alternative-names-present
Tuesday, March 3, 2015
Push a local branch to remote in Git
To push a local branch to remote in Git,
do the following:
git push -u origin issue-1
Reference:
http://stackoverflow.com/questions/2765421/push-a-new-local-branch-to-a-remote-git-repo-and-track-it-too
do the following:
git push -u origin issue-1
Reference:
http://stackoverflow.com/questions/2765421/push-a-new-local-branch-to-a-remote-git-repo-and-track-it-too
Subscribe to:
Posts (Atom)