I have the log file created which I have defined in log4j.properties. But I dont see any trace for struts in that File. I only below entries in the log file.-
05/30/14 12:40:20] source=com.ibm.bcg.consoleUI. action.partners.PartnerCreateAction thread=[WebContainer : 0] Logging initialized. [05/30/14 12:40:20] source=com.ibm.bcg.consoleUI.action.partners.PartnerCreateAction thread=[WebContainer : 0] Log4jProperties: C:\Program Files\ibm\bcghub-distrib\wasND\Profiles\bcgprofile\installedApps\wpgCell\BCGConsole.ear\console.war\WEB-INF\lib\log4j.properties On Fri, May 30, 2014 at 6:36 PM, Paul Benedict <pbened...@apache.org> wrote: > Usha, I don't understand your response. So you have a log file and it's > logging? > > > Cheers, > Paul > > > On Fri, May 30, 2014 at 7:58 AM, Usha Ladkani <ushaladk...@gmail.com> > wrote: > > > property file is in classpath , As the log file is being created with > > trace. > > > > We are not using tomcat. we are using our own webserver which is running > on > > IBM Websphere application server. > > > > > > On Fri, May 30, 2014 at 6:21 PM, Mark Shifman <mark.shif...@yale.edu> > > wrote: > > > > > > > > > > > On 05/30/2014 08:26 AM, Usha Ladkani wrote: > > > > > >> Now empty log file is being created. > > >> > > >> I see this error in systemout which i printed too > > >> > > >> [30/5/14 12:23:48:824 UTC] 00000086 R UOW= source=SystemErr org=IBM > > >> prod=WebSphere component=Application Server thread=[WebContainer : 0] > > >> log4j:WARN No appenders could be found for logger > > >> (com.ibm.bcg.consoleUI.action.partners.PartnerCreateAction). > > >> [30/5/14 12:23:48:839 UTC] 00000086 R UOW= source=SystemErr org=IBM > > >> prod=WebSphere component=Application Server thread=[WebContainer : 0] > > >> log4j:WARN Please initialize the log4j system properly. > > >> > > >> > > >> Below is my property file looks like > > >> > > >> log4j.logger.org.apache.struts=DEBUG, R > > >> log4j.appender.R=org.apache.log4j.RollingFileAppender > > >> log4j.appender.R.File=usha.log > > >> log4j.appender.R.MaxFileSize=10MB > > >> log4j.appender.R.MaxBackupIndex=10 > > >> log4j.appender.R.layout=org.apache.log4j.PatternLayout > > >> log4j.appender.R.layout.ConversionPattern=[%d{MM/dd/yy HH:mm:ss}] > > >> source=%c > > >> thread=[%t] %m%n > > >> > > > Here is yet another example that I use with struts 1 with some > additional > > > comments. > > > Here is yet another example of a log4j.properties file that seems to > > work. > > > (At least for an example for you to play with) > > > > > > log4j.rootCategory=INFO, A2 > > > # A2 is a DailyRollingFileAppender > > > # > > > log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender > > > log4j.appender.A2.ImmediateFlush=true > > > log4j.appender.A2.file=${catalina.home}/logs/myapp_log.txt > > > log4j.appender.A2.datePattern='.'yyyy-MM-dd > > > log4j.appender.A2.append=true > > > log4j.appender.A2.layout=org.apache.log4j.PatternLayout > > > log4j.appender.A2.layout.ConversionPattern=%-5p %d{ISO8601} > > > %M(%F:%L)%n%m%n > > > > > > # Set Struts/Commons log level > > > log4j.logger.org.apache.struts=INFO > > > log4j.logger.org.apache.commons=INFO > > > log4j.logger.org.displaytag=WARN > > > log4j.logger.org.apache.struts.validator=WARN > > > > > > log4j.logger.org.apache.commons.validator.GenericTypeValidator=ERROR > > > log4j.logger.org.apache.struts.chain.commands.servlet.CreateAction=WARN > > > log4j.logger.org.apache.struts.chain.ComposableRequestProcessor=WARN > > > log4j.logger.org.apache.struts.action.ActionServlet=WARN > > > log4j.logger.org.apache.struts.util.PropertyMessageResources=ERROR > > > log4j.logger.org.apache.struts.action.ActionMapping=ERROR > > > > > > log4j.logger.org.exolab.castor.mapping.Mapping=WARN > > > > > > The file needs to be in your "classes" directory on you file path > > > > > > you also have to make sure that catalina.home is known from somewhere. > I > > > use jsvc to start tomcat as a daemon and have > > > an tomcat service file (using centos or redhat) that has these lines. > > > # Source function library. > > > . /etc/init.d/functions > > > > > > # Adapt the following lines to your configuration > > > CATALINA_HOME=/home/apache-tomcat-7.0.20 > > > DAEMON_HOME=/home/apache-tomcat-7.0.20/bin > > > TOMCAT_USER=tomcat > > > > > > CATALINA_OPTS=" -Djava.awt.headless=true > -Djava.net.preferIPv4Stack=true > > > -XX:+UseNUMA -XX:+UseParallelGC -Xms1024M -Xmx1024M > -XX:MaxPermSize=512M > > " > > > CLASSPATH=\ > > > $JAVA_HOME/lib/tools.jar:\ > > > $CATALINA_HOME/bin/commons-daemon.jar:\ > > > $CATALINA_HOME/bin/bootstrap.jar:\ > > > $CATALINA_HOME/bin/tomcat-juli.jar > > > ... > > > I think I had to add "tomcat-juli.jar" to the CLASSPATH above. > > > > > > Also there is src code you have to compile to make a "tomcat-juli.jar" > > > that will understand log4j. > > > > > > 2. > > >> > > >> Download or build |tomcat-juli.jar| and |tomcat-juli-adapters.jar| > > >> that are available as an "extras" component for Tomcat. See Additional > > >> Components documentation <http://tomcat.apache.org/ > > >> tomcat-7.0-doc/extras.html> for details. > > >> > > >> This |tomcat-juli.jar| differs from the default one. It contains > the > > >> full Apache Commons Logging implementation and thus is able to > discover > > the > > >> presense of log4j and configure itself. > > >> > > >> I hope this helps without creating more opacity. > > > mas > > > > > > > > > > > >> > > >> On Fri, May 30, 2014 at 4:48 PM, Christoph Nenning < > > >> christoph.nenn...@lex-com.net> wrote: > > >> > > >> Hello Paul. > > >>>> > > >>>> Now I have configured log4j-1.2.13.jar. Below is my log4j.properties > > >>>> > > >>> file > > >>> > > >>>> content. > > >>>> > > >>>> log4j.rootLogger=DEBUG, R > > >>>> log4j.appender.R=org.apache.log4j.RollingFileAppender > > >>>> log4j.appender.R.File=usha.log > > >>>> log4j.appender.R.MaxFileSize=10MB > > >>>> log4j.appender.R.MaxBackupIndex=10 > > >>>> log4j.appender.R.layout=org.apache.log4j.PatternLayout > > >>>> log4j.appender.R.layout.ConversionPattern=[%d{MM/dd/yy HH:mm:ss}] > > >>>> > > >>> source=%c > > >>> > > >>>> thread=[%t] %m%n > > >>>> > > >>>> I get log file names usha.log created m But it doesnt has any struts > > >>>> related logging after I perform the action. Just the below content > is > > >>>> logged. > > >>>> > > >>>> [05/30/14 09:14:21] > > >>>> source=com.ibm.bcg.consoleUI.action.partners.PartnerCreateAction > > >>>> thread=[WebContainer : 3] Logging initialized. > > >>>> [05/30/14 09:14:21] > > >>>> source=com.ibm.bcg.consoleUI.action.partners.PartnerCreateAction > > >>>> thread=[WebContainer : 3] Log4jProperties: C:\Program > > >>>> Files\ibm\bcghub-distrib\wasND\Profiles\bcgprofile\installedApps > > >>>> \wpgCell\BCGConsole.ear\console.war\WEB-INF\lib\log4j.properties > > >>>> > > >>>> Which are logged by my action class. > > >>>> > > >>>> Could you please help if I am missing something. > > >>>> > > >>>> Thanks > > >>>> Usha > > >>>> > > >>>> > > >>>> You need a line like this: > > >>> > > >>> log4j.logger.org.apache.struts=DEBUG > > >>> > > >>> > > >>> Regards, > > >>> Christoph > > >>> > > >>> This Email was scanned by Sophos Anti Virus > > >>> > > >>> > > > -- > > > Mark Shifman MD. Ph.D. > > > Yale Center for Medical Informatics > > > Phone (203)737-5219 > > > mark.shif...@yale.edu > > > > > > > > >