common-logging, Struts, Log4j
Hi. I have problem in using the common-logging with struts and Log4j. I am basically lost. I have short questions, I appreciate if anyone can help me little bit. these are the questions with examples: The file outputfile.log that I specify in log4j.appender.LOGFILE.File=outputfile.log where it is located? where I find it? is it physical file? I dont know why my configuration is not working, although I put the following files in the classpath WEB-INF/classes/org/myclasses/: commons-logging.properties: org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL ogger log4j.properties: log4j.rootLogger=DEBUG, rolling log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m% n log4j.appender.rolling=org.apache.log4j.RollingFileAppender log4j.appender.rolling.File=outputfile.log log4j.appender.rolling.MaxFileSize=100KB log4j.appender.rolling.MaxBackupIndex=1 log4j.appender.rolling.layout=org.apache.log4j.PatternLayout log4j.appender.rolling.layout.ConversionPattern=%d{ABSOLUTE} - %p % c - %m%n What else should I specify, or configure to make it to work? I have log4j-1.2.4.jar in my WEB-INF/lib/ Should I set any system propreties? or web.xml? or struts-config? In my classes I am doing that: protected static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(this.class); if (log.isDebugEnabled()) log.debug(getMessage( + locale + , + key + )); (How can I enable/disable the Debug or Trace?) Thank you in advance. I am really stuck and I couldnt make it to work. I am using tomcat 4.18 Rabih - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: common-logging, Struts, Log4j
I had the same problem and was only able to solve it by forceably loading the log4j configuration file. I put the following in the servlet's init() method: // get log4j property file. java.net.URL log4jProps = ActionServlet.class.getClassLoader().getResource(log4j.properties); System.out.println(System.out.println - Log4j URL: + log4jProps); // configure log4j PropertyConfigurator.configure(log4jProps); Mike -Original Message- From: rablists [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 7:51 AM To: [EMAIL PROTECTED] Subject: common-logging, Struts, Log4j Hi. I have problem in using the common-logging with struts and Log4j. I am basically lost. I have short questions, I appreciate if anyone can help me little bit. these are the questions with examples: The file outputfile.log that I specify in log4j.appender.LOGFILE.File=outputfile.log where it is located? where I find it? is it physical file? I dont know why my configuration is not working, although I put the following files in the classpath WEB-INF/classes/org/myclasses/: commons-logging.properties: org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL ogger log4j.properties: log4j.rootLogger=DEBUG, rolling log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m% n log4j.appender.rolling=org.apache.log4j.RollingFileAppender log4j.appender.rolling.File=outputfile.log log4j.appender.rolling.MaxFileSize=100KB log4j.appender.rolling.MaxBackupIndex=1 log4j.appender.rolling.layout=org.apache.log4j.PatternLayout log4j.appender.rolling.layout.ConversionPattern=%d{ABSOLUTE} - %p % c - %m%n What else should I specify, or configure to make it to work? I have log4j-1.2.4.jar in my WEB-INF/lib/ Should I set any system propreties? or web.xml? or struts-config? In my classes I am doing that: protected static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(this.class); if (log.isDebugEnabled()) log.debug(getMessage( + locale + , + key + )); (How can I enable/disable the Debug or Trace?) Thank you in advance. I am really stuck and I couldnt make it to work. I am using tomcat 4.18 Rabih - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: common-logging, Struts, Log4j
I have the similar setup and works very well for me. log4j.appender.LOGFILE.File=outputfile.log where it is located? where I find it? is it physical file? It should be saved under the app. server bin dir like c:/tomcat-4.18/bin. I don't use tomcat. But websphere app. server saves this file under bin folder. If you want, you can give absolute path like c:/tomcat-4.18/logs/outputfile.log. log4j.rootLogger=DEBUG, rolling Here you have not declared stdout as an appender. So, all log messages (because you have lowest level DEBUG for rootLogger) will be sent to file declared in rolling appender. You can include stdout in rootLogger like log4j.rootLogger=DEBUG, stdout, rolling and check your tomcat log files to see if there is anything written before you check rolling file permissions etc. Hope this helps. Reddy Original Message- From: rablists [SMTP:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 8:51 AM To: [EMAIL PROTECTED] Subject: common-logging, Struts, Log4j Hi. I have problem in using the common-logging with struts and Log4j. I am basically lost. I have short questions, I appreciate if anyone can help me little bit. these are the questions with examples: The file outputfile.log that I specify in log4j.appender.LOGFILE.File=outputfile.log where it is located? where I find it? is it physical file? I dont know why my configuration is not working, although I put the following files in the classpath WEB-INF/classes/org/myclasses/: commons-logging.properties: org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL ogger log4j.properties: log4j.rootLogger=DEBUG, rolling log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m% n log4j.appender.rolling=org.apache.log4j.RollingFileAppender log4j.appender.rolling.File=outputfile.log log4j.appender.rolling.MaxFileSize=100KB log4j.appender.rolling.MaxBackupIndex=1 log4j.appender.rolling.layout=org.apache.log4j.PatternLayout log4j.appender.rolling.layout.ConversionPattern=%d{ABSOLUTE} - %p % c - %m%n What else should I specify, or configure to make it to work? I have log4j-1.2.4.jar in my WEB-INF/lib/ Should I set any system propreties? or web.xml? or struts-config? In my classes I am doing that: protected static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(this.class); if (log.isDebugEnabled()) log.debug(getMessage( + locale + , + key + )); (How can I enable/disable the Debug or Trace?) Thank you in advance. I am really stuck and I couldnt make it to work. I am using tomcat 4.18 Rabih - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: common-logging, Struts, Log4j
By default the property-files commons-logging.properties log4j.properties are located in the directory WEB-INF/classes Usually you put them in your workbench in the root of the Java Source directory. If you build with ant you simply copy them there from your chosen source directory Markus rablists wrote: Hi. I have problem in using the common-logging with struts and Log4j. I am basically lost. I have short questions, I appreciate if anyone can help me little bit. these are the questions with examples: The file outputfile.log that I specify in log4j.appender.LOGFILE.File=outputfile.log where it is located? where I find it? is it physical file? I dont know why my configuration is not working, although I put the following files in the classpath WEB-INF/classes/org/myclasses/: commons-logging.properties: org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL ogger log4j.properties: log4j.rootLogger=DEBUG, rolling log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m% n log4j.appender.rolling=org.apache.log4j.RollingFileAppender log4j.appender.rolling.File=outputfile.log log4j.appender.rolling.MaxFileSize=100KB log4j.appender.rolling.MaxBackupIndex=1 log4j.appender.rolling.layout=org.apache.log4j.PatternLayout log4j.appender.rolling.layout.ConversionPattern=%d{ABSOLUTE} - %p % c - %m%n What else should I specify, or configure to make it to work? I have log4j-1.2.4.jar in my WEB-INF/lib/ Should I set any system propreties? or web.xml? or struts-config? In my classes I am doing that: protected static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(this.class); if (log.isDebugEnabled()) log.debug(getMessage( + locale + , + key + )); (How can I enable/disable the Debug or Trace?) Thank you in advance. I am really stuck and I couldnt make it to work. I am using tomcat 4.18 Rabih - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: common-logging, Struts, Log4j
Rabih, You place the properties files at the wrong place. Move them to WEB-INF/classes -D - Original Message - From: rablists [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 26, 2003 5:50 AM Subject: common-logging, Struts, Log4j Hi. I have problem in using the common-logging with struts and Log4j. I am basically lost. I have short questions, I appreciate if anyone can help me little bit. these are the questions with examples: The file outputfile.log that I specify in log4j.appender.LOGFILE.File=outputfile.log where it is located? where I find it? is it physical file? I dont know why my configuration is not working, although I put the following files in the classpath WEB-INF/classes/org/myclasses/: commons-logging.properties: org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL ogger log4j.properties: log4j.rootLogger=DEBUG, rolling log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m% n log4j.appender.rolling=org.apache.log4j.RollingFileAppender log4j.appender.rolling.File=outputfile.log log4j.appender.rolling.MaxFileSize=100KB log4j.appender.rolling.MaxBackupIndex=1 log4j.appender.rolling.layout=org.apache.log4j.PatternLayout log4j.appender.rolling.layout.ConversionPattern=%d{ABSOLUTE} - %p % c - %m%n What else should I specify, or configure to make it to work? I have log4j-1.2.4.jar in my WEB-INF/lib/ Should I set any system propreties? or web.xml? or struts-config? In my classes I am doing that: protected static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(this.class); if (log.isDebugEnabled()) log.debug(getMessage( + locale + , + key + )); (How can I enable/disable the Debug or Trace?) Thank you in advance. I am really stuck and I couldnt make it to work. I am using tomcat 4.18 Rabih - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: common-logging, Struts, Log4j
Thank you. It worked fine. The properties files should be under WEB- INF/classes directly. Plus, the major problem was with the commons- logging jar files: I should put in the WEB-INF/lib only the commons- logging.jar, and delete the commons-logging-api.jar, which should be placed instead under the tomact/common/lib/ Confusing but it worked fine. Rabih. --- In [EMAIL PROTECTED], Pingili, Madhupal [EMAIL PROTECTED] wrote: I have the similar setup and works very well for me. log4j.appender.LOGFILE.File=outputfile.log where it is located? where I find it? is it physical file? It should be saved under the app. server bin dir like c:/tomcat- 4.18/bin. I don't use tomcat. But websphere app. server saves this file under bin folder. If you want, you can give absolute path like c:/tomcat-4.18/logs/outputfile.log. log4j.rootLogger=DEBUG, rolling Here you have not declared stdout as an appender. So, all log messages (because you have lowest level DEBUG for rootLogger) will be sent to file declared in rolling appender. You can include stdout in rootLogger like log4j.rootLogger=DEBUG, stdout, rolling and check your tomcat log files to see if there is anything written before you check rolling file permissions etc. Hope this helps. Reddy Original Message- From: rablists [SMTP:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 8:51 AM To: [EMAIL PROTECTED] Subject:common-logging, Struts, Log4j Hi. I have problem in using the common-logging with struts and Log4j. I am basically lost. I have short questions, I appreciate if anyone can help me little bit. these are the questions with examples: The file outputfile.log that I specify in log4j.appender.LOGFILE.File=outputfile.log where it is located? where I find it? is it physical file? I dont know why my configuration is not working, although I put the following files in the classpath WEB-INF/classes/org/myclasses/: commons-logging.properties: org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL ogger log4j.properties: log4j.rootLogger=DEBUG, rolling log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m% n log4j.appender.rolling=org.apache.log4j.RollingFileAppender log4j.appender.rolling.File=outputfile.log log4j.appender.rolling.MaxFileSize=100KB log4j.appender.rolling.MaxBackupIndex=1 log4j.appender.rolling.layout=org.apache.log4j.PatternLayout log4j.appender.rolling.layout.ConversionPattern=%d{ABSOLUTE} - % p % c - %m%n What else should I specify, or configure to make it to work? I have log4j-1.2.4.jar in my WEB-INF/lib/ Should I set any system propreties? or web.xml? or struts- config? In my classes I am doing that: protected static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(this.class); if (log.isDebugEnabled()) log.debug(getMessage( + locale + , + key + )); (How can I enable/disable the Debug or Trace?) Thank you in advance. I am really stuck and I couldnt make it to work. I am using tomcat 4.18 Rabih - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]