You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by rablists <ra...@yahoo.co.uk> on 2003/06/26 14:51:04 UTC

common-logging, struts, Log4j, tomcat

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: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: common-logging, struts, Log4j, tomcat

Posted by Jacob Kjome <ho...@visi.com>.
At 12:51 PM 6/26/2003 +0000, you 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:

First, if you are using commons-logging, then that is a question for 
another list.  If you are using log4j directly, which your configuration

file below seems to suggest, then read on...

>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?

If you specify your file like this, it will be written to the location 
where the JVM is started.  If you are using Tomcat's startup scripts,
then 
this would be in CATALINA_HOME/bin.  Look there for your
"outputfile.log".

>I dont know why my configuration is not working, although I put the
>following files in the classpath WEB-INF/classes/org/myclasses/:

huh?  How did you come up with this as a valid place to put your 
log4j.properties file for automatic discovery by log4j?  Try plain old 
WEB-INF/classes which is where it should be.

>commons-logging.properties:
>org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL
>ogger

No idea.  This list isn't about commons logging, nor do I encourage its
use 
since it seems to be the cause of so many problems.  Just use log4j 
directly if possible, although I know struts uses it so you have to have
it 
present there.

>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

This looks fine.  If you follow my comments above, this should work.

>What else should I specify, or configure to make it to work? I have
>log4j-1.2.4.jar in my WEB-INF/lib/

Why are you using such an ancient version of log4j?  log4j-1.2.8.jar is
the 
latest and has some important fixes, so I highly recommend the upgrade.

>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?)

No idea.  Again, this is commons-logging you are talking about.  Ask
their 
list.


>Thank you in advance. I am really stuck and I couldnt make it to
>work. I am using tomcat 4.18

Why not Tomcat-4.1.24, the latest bugfixed version of Tomcat?  Again, I 
highly recommend the upgrade.


Jake


>Rabih
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org


**************************Disclaimer************************************

Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' and 'confidential' and intended for use only by the individual
 or entity to which it is addressed. You are notified that any use, copying 
or dissemination of the information contained in the E-MAIL in any manner 
whatsoever is strictly prohibited.

***************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: common-logging, struts, Log4j, tomcat

Posted by Jacob Kjome <ho...@visi.com>.
At 12:51 PM 6/26/2003 +0000, you 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:

First, if you are using commons-logging, then that is a question for 
another list.  If you are using log4j directly, which your configuration 
file below seems to suggest, then read on...

>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?

If you specify your file like this, it will be written to the location 
where the JVM is started.  If you are using Tomcat's startup scripts, then 
this would be in CATALINA_HOME/bin.  Look there for your "outputfile.log".

>I dont know why my configuration is not working, although I put the
>following files in the classpath WEB-INF/classes/org/myclasses/:

huh?  How did you come up with this as a valid place to put your 
log4j.properties file for automatic discovery by log4j?  Try plain old 
WEB-INF/classes which is where it should be.

>commons-logging.properties:
>org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL
>ogger

No idea.  This list isn't about commons logging, nor do I encourage its use 
since it seems to be the cause of so many problems.  Just use log4j 
directly if possible, although I know struts uses it so you have to have it 
present there.

>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

This looks fine.  If you follow my comments above, this should work.

>What else should I specify, or configure to make it to work? I have
>log4j-1.2.4.jar in my WEB-INF/lib/

Why are you using such an ancient version of log4j?  log4j-1.2.8.jar is the 
latest and has some important fixes, so I highly recommend the upgrade.

>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?)

No idea.  Again, this is commons-logging you are talking about.  Ask their 
list.


>Thank you in advance. I am really stuck and I couldnt make it to
>work. I am using tomcat 4.18

Why not Tomcat-4.1.24, the latest bugfixed version of Tomcat?  Again, I 
highly recommend the upgrade.


Jake


>Rabih
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org