log4j.properties
log4j.rootLogger=FINE, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c:%L - %m%n
log4j.category.my.root.package=FINEST
私のクラス
public class MyClass {
private static final Logger logger = Logger.getLogger(MyClass.class.getName());
public boolean download(String destinationPath) {
HttpURLConnection con = null;
int i;
try {
logger.log(Level.FINE, "Download URL {0}", new Object[] { url.toString()});
con = (HttpURLConnection) url.openConnection();
con.setInstanceFollowRedirects(true);
InputStream is = con.getInputStream();
....
url.openConnection();
ブレークポイントがラインに達しているにもかかわらず、Level.FINE
コンソールに表示されません。これが私が見るコンソールです:
INFO: Order: #298596(Status: 1)
15:00:58,532 DEBUG main org.hibernate.engine.transaction.spi.AbstractTransactionImpl:158 - begin
15:00:58,532 DEBUG main org.hibernate.engine.jdbc.internal.LogicalConnectionImpl:295 - Obtaining JDBC connection
15:00:58,558 DEBUG main org.hibernate.engine.jdbc.internal.LogicalConnectionImpl:301 - Obtained JDBC connection
15:00:58,559 DEBUG main org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction:69 - initial autocommit status: true
15:00:58,559 DEBUG main org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction:71 - disabling autocommit
15:00:58,615 DEBUG main org.hibernate.SQL:104 - MY-QUERY
15:00:58,657 DEBUG main org.hibernate.engine.transaction.spi.AbstractTransactionImpl:173 - committing
15:00:58,661 DEBUG main org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction:113 - committed JDBC Connection
15:00:58,661 DEBUG main org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction:126 - re-enabling autocommit
15:00:58,664 DEBUG main org.hibernate.engine.jdbc.internal.LogicalConnectionImpl:314 - Releasing JDBC connection
15:00:58,664 DEBUG main org.hibernate.engine.jdbc.internal.LogicalConnectionImpl:332 - Released JDBC connection
15:00:58,664 DEBUG main org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler:219 - HHH000163: Logical connection releasing its physical connection
INFO: #298596: Importing...
独自のカスタム ログが表示されないのはなぜですか?
に変更log4j.rootLogger=FINE, stdout
すると、コンソールからlog4j.rootLogger=INFO, stdout
すべてが非表示DEBUG
になるため、このファイルが解析されていることがわかります。