我正在使用log4j
api 来维护我的应用程序的日志。我在初始化时使用了以下private Logger logger;
logger = Logger.getLogger("Application Started ");
但它显示Application Started
在每个动作中,如下所示:
[ INFO] [2013-08-19 11:50:41,140] AWT-EventQueue-0 Application Started at Mon Aug 19 11:50:33 NPT 2013 (SMSCMainFrame.java:248)- SMSC Setup Panel opened.
[ INFO] [2013-08-19 12:00:15,423] AWT-EventQueue-0 Application Started at Mon Aug 19 12:00:08 NPT 2013 (SMSCMainFrame.java:247)-
SMSC Setup Panel opened.
[ INFO] [2013-08-19 12:00:17,576] AWT-EventQueue-0 Application Started at Mon Aug 19 12:00:08 NPT 2013 (SMSCMainFrame.java:264)-
Key messaage setup panel opened.
[ INFO] [2013-08-19 12:00:19,713] AWT-EventQueue-0 Application Started at Mon Aug 19 12:00:08 NPT 2013 (SMSCMainFrame.java:282)-
Binding details panel opened
[ INFO] [2013-08-19 12:00:21,850] AWT-EventQueue-0 Application Started at Mon Aug 19 12:00:08 NPT 2013 (SMSCMainFrame.java:353)-
Key Message Details Panel opened
[ INFO] [2013-08-19 12:00:23,093] AWT-EventQueue-0 Application Started at Mon Aug 19 12:00:08 NPT 2013 (SMSCMainFrame.java:371)-
Blocked Smsc Details panel opened.
[ INFO] [2013-08-19 12:00:24,575] AWT-EventQueue-0 Application Started at Mon Aug 19 12:00:08 NPT 2013 (SMSCMainFrame.java:335)-
Request response report panel opened.
我只想Application started
在我的应用程序启动时显示一次消息。
像 :
[ INFO] [2013-08-19 11:50:41,140] AWT-EventQueue-0 Application Started...
那么只有其他日志应该显示在我的日志文件中。
请帮我。谢谢