turning on debugging with commons logging

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

turning on debugging with commons logging

Darren Hall
Greeting all,

 

I'm having a hard time turning on debugging in Apache struts (which is using
commons logging).

I know this should be easy to do, however I'm having a hard time finding the
information on the web.

Can anyone here tell me how to configure commons logging so that it will
display DEBUG level statements, please (currently it displays on INFO level
and above)?

 

Thanks,

 

Darren

Reply | Threaded
Open this post in threaded view
|

Re: turning on debugging with commons logging

Chr. Grobmeier
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> I'm having a hard time turning on debugging in Apache struts (which is using
> commons logging).
>
> I know this should be easy to do, however I'm having a hard time finding the
> information on the web.
>
> Can anyone here tell me how to configure commons logging so that it will
> display DEBUG level statements, please (currently it displays on INFO level
> and above)?

i have the same problem. Are using jetty too?
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEjtegkv8rKBUE/T4RAuM3AJ9wIFal4fL2X+nmRLKYYqnbGTcb7wCfc5WZ
BtuotHXab0mYb5ClRsvAlwY=
=pSY+
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: turning on debugging with commons logging

Darren Hall
No, I'm not. I'm using the default install of Struts 1.2.9 with Tomcat 5.5.
Essentially "out of the box" the commons-logging functionality in Struts
will write to the current day's "catalina.log" file. This is not optimal,
but it is workable. And it does log messages properly; however it is only
logging INFO level and above level messages.

Apparently my "isDebugEnabled" flag hasn't been set as far as Struts is
concerned, and I'm looking for a configuration setting that I've missed to
set my loging level (possible in my web.xml file or struts-config.xml file).

I wasn't certain if this issue was more pertaining to commons-logging or
Struts, so I posted this message in both listservs.

Darren


-----Original Message-----
From: C. Grobmeier [mailto:[hidden email]]
Sent: Tuesday, June 13, 2006 11:20 AM
To: Jakarta Commons Users List
Subject: Re: turning on debugging with commons logging

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> I'm having a hard time turning on debugging in Apache struts (which is
using
> commons logging).
>
> I know this should be easy to do, however I'm having a hard time finding
the
> information on the web.
>
> Can anyone here tell me how to configure commons logging so that it will
> display DEBUG level statements, please (currently it displays on INFO
level
> and above)?

i have the same problem. Are using jetty too?
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEjtegkv8rKBUE/T4RAuM3AJ9wIFal4fL2X+nmRLKYYqnbGTcb7wCfc5WZ
BtuotHXab0mYb5ClRsvAlwY=
=pSY+
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]





---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: turning on debugging with commons logging

Dennis Lundberg-2
In reply to this post by Darren Hall
Darren Hall wrote:

> Greeting all,
>
>  
>
> I'm having a hard time turning on debugging in Apache struts (which is using
> commons logging).
>
> I know this should be easy to do, however I'm having a hard time finding the
> information on the web.
>
> Can anyone here tell me how to configure commons logging so that it will
> display DEBUG level statements, please (currently it displays on INFO level
> and above)?

This all depends on what underlying logging implementation that your app
or Struts is using. I haven't used Struts myself, so cannot comment on
how to configure Struts.

The general user guide for commons-logging is here:
http://jakarta.apache.org/commons/logging/commons-logging-1.1/guide.html

If your app is using SimpleLog then this is the good place to look:
http://jakarta.apache.org/commons/logging/apidocs/org/apache/commons/logging/impl/SimpleLog.html

If your app is using JDK logging (if you are running on Java 1.4+) you
should consult the documentation for the JDK.


--
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: turning on debugging with commons logging

Darren Hall
Thanks Dennis,

I'm using Struts "out of the box" so I have no logging package in place.
I have no commons-logging.properties file and nothing referring to Log4J or
anything of the sort.

It seems to me that commons-logging is using the Tomcat default logging
(thus it outputs to 'catalina.log').

I've gone ahead and downloaded Log4J and included the Log4J.jar file in my
WEB-INF/lib directory when deploying my webapp. I've also created a
commons-logging.properties file (below) that I found as an example online.

#########################

#
# $Id: commons-logging.properties,v 1.0 2006/06/31 14:35:33Z dhall $
#

#
# This file controls which logging package the Jakarta Commons Logging
package
# uses. This can be changed to point to any supported logging package. See
# http://jakarta.apache.org/commons/logging for a list of supported logging
# packages.
#
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jF
actory

#########################

However, when I try to deploy my war file in Tomcat I now get a
ClassDefNotFound org.apache.commons.logging.impl.Log4jFactory error.

On the commons-logging website, I see that Log4jFactory is deprecated and
not included in commons-logging 1.1 and beyond.

How do I tell commons-logging to use Log4j (or do I not tell it since it
looks for it by default)?

Thanks,

Darren



-----Original Message-----
From: Dennis Lundberg [mailto:[hidden email]]
Sent: Tuesday, June 13, 2006 2:41 PM
To: Jakarta Commons Users List
Subject: Re: turning on debugging with commons logging

Darren Hall wrote:
> Greeting all,
>
>  
>
> I'm having a hard time turning on debugging in Apache struts (which is
using
> commons logging).
>
> I know this should be easy to do, however I'm having a hard time finding
the
> information on the web.
>
> Can anyone here tell me how to configure commons logging so that it will
> display DEBUG level statements, please (currently it displays on INFO
level
> and above)?

This all depends on what underlying logging implementation that your app
or Struts is using. I haven't used Struts myself, so cannot comment on
how to configure Struts.

The general user guide for commons-logging is here:
http://jakarta.apache.org/commons/logging/commons-logging-1.1/guide.html

If your app is using SimpleLog then this is the good place to look:
http://jakarta.apache.org/commons/logging/apidocs/org/apache/commons/logging
/impl/SimpleLog.html

If your app is using JDK logging (if you are running on Java 1.4+) you
should consult the documentation for the JDK.


--
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]





---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: turning on debugging with commons logging

Chr. Grobmeier
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> However, when I try to deploy my war file in Tomcat I now get a
> ClassDefNotFound org.apache.commons.logging.impl.Log4jFactory error.
>
> On the commons-logging website, I see that Log4jFactory is deprecated and
> not included in commons-logging 1.1 and beyond.
>
> How do I tell commons-logging to use Log4j (or do I not tell it since it
> looks for it by default)?

As far as i know, just put the log4j.jar in your webapps classpath.

Cheers,
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEjyEykv8rKBUE/T4RAtBHAJ4xnGSAwlUPJVweuWqKw/odnbpEzQCeJC/m
a6m2izGSzOBJUPJRD9voNKM=
=fmqz
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: turning on debugging with commons logging

Dennis Lundberg-2
In reply to this post by Darren Hall
Darren Hall wrote:

> Thanks Dennis,
>
> I'm using Struts "out of the box" so I have no logging package in place.
> I have no commons-logging.properties file and nothing referring to Log4J or
> anything of the sort.
>
> It seems to me that commons-logging is using the Tomcat default logging
> (thus it outputs to 'catalina.log').
>
> I've gone ahead and downloaded Log4J and included the Log4J.jar file in my
> WEB-INF/lib directory when deploying my webapp. I've also created a
> commons-logging.properties file (below) that I found as an example online.
>
> #########################
>
> #
> # $Id: commons-logging.properties,v 1.0 2006/06/31 14:35:33Z dhall $
> #
>
> #
> # This file controls which logging package the Jakarta Commons Logging
> package
> # uses. This can be changed to point to any supported logging package. See
> # http://jakarta.apache.org/commons/logging for a list of supported logging
> # packages.
> #
> org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jF
> actory
>
> #########################
>
> However, when I try to deploy my war file in Tomcat I now get a
> ClassDefNotFound org.apache.commons.logging.impl.Log4jFactory error.
>
> On the commons-logging website, I see that Log4jFactory is deprecated and
> not included in commons-logging 1.1 and beyond.

You should use this line instead:
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger

> How do I tell commons-logging to use Log4j (or do I not tell it since it
> looks for it by default)?

It's better to specify the logging implementation, if you want to be in
control. Otherwise the logging implementation chosen by commons-logging
might differ, for example on different servers like development and
production.

>
> Thanks,
>
> Darren
>
>
>
> -----Original Message-----
> From: Dennis Lundberg [mailto:[hidden email]]
> Sent: Tuesday, June 13, 2006 2:41 PM
> To: Jakarta Commons Users List
> Subject: Re: turning on debugging with commons logging
>
> Darren Hall wrote:
>> Greeting all,
>>
>>  
>>
>> I'm having a hard time turning on debugging in Apache struts (which is
> using
>> commons logging).
>>
>> I know this should be easy to do, however I'm having a hard time finding
> the
>> information on the web.
>>
>> Can anyone here tell me how to configure commons logging so that it will
>> display DEBUG level statements, please (currently it displays on INFO
> level
>> and above)?
>
> This all depends on what underlying logging implementation that your app
> or Struts is using. I haven't used Struts myself, so cannot comment on
> how to configure Struts.
>
> The general user guide for commons-logging is here:
> http://jakarta.apache.org/commons/logging/commons-logging-1.1/guide.html
>
> If your app is using SimpleLog then this is the good place to look:
> http://jakarta.apache.org/commons/logging/apidocs/org/apache/commons/logging
> /impl/SimpleLog.html
>
> If your app is using JDK logging (if you are running on Java 1.4+) you
> should consult the documentation for the JDK.
>
>


--
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: turning on debugging with commons logging

Darren Hall
Excellent!

My application deploys with no exceptions - however (and now I'm venturing
into the Log4j side of things) I don't appear to be producing any log output
at all.

Dennis, if I could bother you one more time - I'm not sure how much of a
Log4j expert you are, but here is the log4j.xml file I've created (modified
from one I found online). When I deploy my war file and the servlet
initializes, it should produce logging output. In my log4j.xml file, I've
specified log file to be 'DailyFileAppender' types located in the 'log'
directory. However, after deploying my webapp, I can't find my log files
anywhere on my machine. Where did I go wrong?

Thanks for your help!

Darren

(log4j.xml)

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

  <appender name="event_file" class="org.apache.log4j.DailyFileAppender">
    <param name="Threshold" value="DEBUG"/>
    <param name="File" value="log/uwaf-event.log"/>
    <param name="Append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
    </layout>
  </appender>

  <appender name="error_file" class="org.apache.log4j.DailyFileAppender">
    <param name="Threshold" value="INFO"/>
    <param name="File" value="log/uwaf-error.log"/>
    <param name="Append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
    </layout>
  </appender>

  <appender name="console" class="org.apache.log4j.ConsoleAppender">
    <param name="Target" value="System.out"/>
    <param name="Threshold" value="INFO"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}]
%m%n"/>
    </layout>
  </appender>

  <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
    <appender-ref ref="event_file"/>
    <appender-ref ref="error_file"/>
  </appender>

  <!-- Setup the Root category -->
  <root>
    <appender-ref ref="ASYNC"/>
  </root>

</log4j:configuration>



-----Original Message-----
From: Dennis Lundberg [mailto:[hidden email]]
Sent: Tuesday, June 13, 2006 5:04 PM
To: Jakarta Commons Users List
Subject: Re: turning on debugging with commons logging

Darren Hall wrote:
> Thanks Dennis,
>
> I'm using Struts "out of the box" so I have no logging package in place.
> I have no commons-logging.properties file and nothing referring to Log4J
or

> anything of the sort.
>
> It seems to me that commons-logging is using the Tomcat default logging
> (thus it outputs to 'catalina.log').
>
> I've gone ahead and downloaded Log4J and included the Log4J.jar file in my
> WEB-INF/lib directory when deploying my webapp. I've also created a
> commons-logging.properties file (below) that I found as an example online.
>
> #########################
>
> #
> # $Id: commons-logging.properties,v 1.0 2006/06/31 14:35:33Z dhall $
> #
>
> #
> # This file controls which logging package the Jakarta Commons Logging
> package
> # uses. This can be changed to point to any supported logging package. See
> # http://jakarta.apache.org/commons/logging for a list of supported
logging
> # packages.
> #
>
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jF
> actory
>
> #########################
>
> However, when I try to deploy my war file in Tomcat I now get a
> ClassDefNotFound org.apache.commons.logging.impl.Log4jFactory error.
>
> On the commons-logging website, I see that Log4jFactory is deprecated and
> not included in commons-logging 1.1 and beyond.

You should use this line instead:
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger

> How do I tell commons-logging to use Log4j (or do I not tell it since it
> looks for it by default)?

It's better to specify the logging implementation, if you want to be in
control. Otherwise the logging implementation chosen by commons-logging
might differ, for example on different servers like development and
production.

>
> Thanks,
>
> Darren
>
>
>
> -----Original Message-----
> From: Dennis Lundberg [mailto:[hidden email]]
> Sent: Tuesday, June 13, 2006 2:41 PM
> To: Jakarta Commons Users List
> Subject: Re: turning on debugging with commons logging
>
> Darren Hall wrote:
>> Greeting all,
>>
>>  
>>
>> I'm having a hard time turning on debugging in Apache struts (which is
> using
>> commons logging).
>>
>> I know this should be easy to do, however I'm having a hard time finding
> the
>> information on the web.
>>
>> Can anyone here tell me how to configure commons logging so that it will
>> display DEBUG level statements, please (currently it displays on INFO
> level
>> and above)?
>
> This all depends on what underlying logging implementation that your app
> or Struts is using. I haven't used Struts myself, so cannot comment on
> how to configure Struts.
>
> The general user guide for commons-logging is here:
> http://jakarta.apache.org/commons/logging/commons-logging-1.1/guide.html
>
> If your app is using SimpleLog then this is the good place to look:
>
http://jakarta.apache.org/commons/logging/apidocs/org/apache/commons/logging
> /impl/SimpleLog.html
>
> If your app is using JDK logging (if you are running on Java 1.4+) you
> should consult the documentation for the JDK.
>
>


--
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]





---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: turning on debugging with commons logging

Dennis Lundberg-2
Darren Hall wrote:

> Excellent!
>
> My application deploys with no exceptions - however (and now I'm venturing
> into the Log4j side of things) I don't appear to be producing any log output
> at all.
>
> Dennis, if I could bother you one more time - I'm not sure how much of a
> Log4j expert you are, but here is the log4j.xml file I've created (modified
> from one I found online). When I deploy my war file and the servlet
> initializes, it should produce logging output. In my log4j.xml file, I've
> specified log file to be 'DailyFileAppender' types located in the 'log'
> directory. However, after deploying my webapp, I can't find my log files
> anywhere on my machine. Where did I go wrong?

Did you create the log directory? I don't think that log4j creates
directories by itself, but it might differ between the various appenders.

--
Dennis Lundberg


>
> Thanks for your help!
>
> Darren
>
> (log4j.xml)
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
>
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
>
>   <appender name="event_file" class="org.apache.log4j.DailyFileAppender">
>     <param name="Threshold" value="DEBUG"/>
>     <param name="File" value="log/uwaf-event.log"/>
>     <param name="Append" value="true"/>
>     <layout class="org.apache.log4j.PatternLayout">
>       <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
>     </layout>
>   </appender>
>
>   <appender name="error_file" class="org.apache.log4j.DailyFileAppender">
>     <param name="Threshold" value="INFO"/>
>     <param name="File" value="log/uwaf-error.log"/>
>     <param name="Append" value="true"/>
>     <layout class="org.apache.log4j.PatternLayout">
>       <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
>     </layout>
>   </appender>
>
>   <appender name="console" class="org.apache.log4j.ConsoleAppender">
>     <param name="Target" value="System.out"/>
>     <param name="Threshold" value="INFO"/>
>     <layout class="org.apache.log4j.PatternLayout">
>       <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}]
> %m%n"/>
>     </layout>
>   </appender>
>
>   <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
>     <appender-ref ref="event_file"/>
>     <appender-ref ref="error_file"/>
>   </appender>
>
>   <!-- Setup the Root category -->
>   <root>
>     <appender-ref ref="ASYNC"/>
>   </root>
>
> </log4j:configuration>
>
>
>
> -----Original Message-----
> From: Dennis Lundberg [mailto:[hidden email]]
> Sent: Tuesday, June 13, 2006 5:04 PM
> To: Jakarta Commons Users List
> Subject: Re: turning on debugging with commons logging
>
> Darren Hall wrote:
>> Thanks Dennis,
>>
>> I'm using Struts "out of the box" so I have no logging package in place.
>> I have no commons-logging.properties file and nothing referring to Log4J
> or
>> anything of the sort.
>>
>> It seems to me that commons-logging is using the Tomcat default logging
>> (thus it outputs to 'catalina.log').
>>
>> I've gone ahead and downloaded Log4J and included the Log4J.jar file in my
>> WEB-INF/lib directory when deploying my webapp. I've also created a
>> commons-logging.properties file (below) that I found as an example online.
>>
>> #########################
>>
>> #
>> # $Id: commons-logging.properties,v 1.0 2006/06/31 14:35:33Z dhall $
>> #
>>
>> #
>> # This file controls which logging package the Jakarta Commons Logging
>> package
>> # uses. This can be changed to point to any supported logging package. See
>> # http://jakarta.apache.org/commons/logging for a list of supported
> logging
>> # packages.
>> #
>>
> org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jF
>> actory
>>
>> #########################
>>
>> However, when I try to deploy my war file in Tomcat I now get a
>> ClassDefNotFound org.apache.commons.logging.impl.Log4jFactory error.
>>
>> On the commons-logging website, I see that Log4jFactory is deprecated and
>> not included in commons-logging 1.1 and beyond.
>
> You should use this line instead:
> org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
>
>> How do I tell commons-logging to use Log4j (or do I not tell it since it
>> looks for it by default)?
>
> It's better to specify the logging implementation, if you want to be in
> control. Otherwise the logging implementation chosen by commons-logging
> might differ, for example on different servers like development and
> production.
>
>> Thanks,
>>
>> Darren
>>
>>
>>
>> -----Original Message-----
>> From: Dennis Lundberg [mailto:[hidden email]]
>> Sent: Tuesday, June 13, 2006 2:41 PM
>> To: Jakarta Commons Users List
>> Subject: Re: turning on debugging with commons logging
>>
>> Darren Hall wrote:
>>> Greeting all,
>>>
>>>  
>>>
>>> I'm having a hard time turning on debugging in Apache struts (which is
>> using
>>> commons logging).
>>>
>>> I know this should be easy to do, however I'm having a hard time finding
>> the
>>> information on the web.
>>>
>>> Can anyone here tell me how to configure commons logging so that it will
>>> display DEBUG level statements, please (currently it displays on INFO
>> level
>>> and above)?
>> This all depends on what underlying logging implementation that your app
>> or Struts is using. I haven't used Struts myself, so cannot comment on
>> how to configure Struts.
>>
>> The general user guide for commons-logging is here:
>> http://jakarta.apache.org/commons/logging/commons-logging-1.1/guide.html
>>
>> If your app is using SimpleLog then this is the good place to look:
>>
> http://jakarta.apache.org/commons/logging/apidocs/org/apache/commons/logging
>> /impl/SimpleLog.html
>>
>> If your app is using JDK logging (if you are running on Java 1.4+) you
>> should consult the documentation for the JDK.
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: turning on debugging with commons logging

Kenneth Huang
Dear all:

I try to put a file 'log4j.properties' to the roof of the source fold. And any class which use Log4j to output can use the properties.
I don't use Apache Struts, but I think copying the log4j.properties to WEB-INF should be OK.

The follow is the content of 'log4j.properties'
--------------------------
# All logging output sent to standard out and a file
# WARN is default logging level
log4j.rootCategory=WARN, STDOUT

# Application logging level is DEBUG
log4j.logger.com.discursive=ERROR, FILE

# Configure the Standard Out Appender
log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
log4j.appender.STDOUT.layout.ConversionPattern=%5p (%F:%L) %m%n

# Configure a rolling file appender
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.File=output.log
log4j.appender.FILE.MaxFileSize=2000KB
log4j.appender.FILE.MaxBackupIndex=5
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d %-5p %c - %m%n
----------------------------










----------------
Kenneth Huang
2006-06-14



Darren  Hall  wrote:

>  Excellent!
>  
>  My  application  deploys  with  no  exceptions  -  however  (and  now  I'm  venturing
>  into  the  Log4j  side  of  things)  I  don't  appear  to  be  producing  any  log  output
>  at  all.
>  
>  Dennis,  if  I  could  bother  you  one  more  time  -  I'm  not  sure  how  much  of  a
>  Log4j  expert  you  are,  but  here  is  the  log4j.xml  file  I've  created  (modified
>  from  one  I  found  online).  When  I  deploy  my  war  file  and  the  servlet
>  initializes,  it  should  produce  logging  output.  In  my  log4j.xml  file,  I've
>  specified  log  file  to  be  'DailyFileAppender'  types  located  in  the  'log'
>  directory.  However,  after  deploying  my  webapp,  I  can't  find  my  log  files
>  anywhere  on  my  machine.  Where  did  I  go  wrong?

Did  you  create  the  log  directory?  I  don't  think  that  log4j  creates  
directories  by  itself,  but  it  might  differ  between  the  various  appenders.

--  
Dennis  Lundberg


>  
>  Thanks  for  your  help!
>  
>  Darren
>  
>  (log4j.xml)
>  
>   <?xml  version="1.0"  encoding="UTF-8"  ? >
>   <!DOCTYPE  log4j:configuration  SYSTEM  "log4j.dtd" >
>  
>   <log4j:configuration  xmlns:log4j="http://jakarta.apache.org/log4j/" >
>  
>       <appender  name="event_file"  class="org.apache.log4j.DailyFileAppender" >
>           <param  name="Threshold"  value="DEBUG"/ >
>           <param  name="File"  value="log/uwaf-event.log"/ >
>           <param  name="Append"  value="true"/ >
>           <layout  class="org.apache.log4j.PatternLayout" >
>               <param  name="ConversionPattern"  value="%d  %-5p  [%c]  %m%n"/ >
>           </layout >
>       </appender >
>  
>       <appender  name="error_file"  class="org.apache.log4j.DailyFileAppender" >
>           <param  name="Threshold"  value="INFO"/ >
>           <param  name="File"  value="log/uwaf-error.log"/ >
>           <param  name="Append"  value="true"/ >
>           <layout  class="org.apache.log4j.PatternLayout" >
>               <param  name="ConversionPattern"  value="%d  %-5p  [%c]  %m%n"/ >
>           </layout >
>       </appender >
>  
>       <appender  name="console"  class="org.apache.log4j.ConsoleAppender" >  
>           <param  name="Target"  value="System.out"/ >  
>           <param  name="Threshold"  value="INFO"/ >
>           <layout  class="org.apache.log4j.PatternLayout" >  
>               <param  name="ConversionPattern"  value="%d{ABSOLUTE}  %-5p  [%c{1}]
>  %m%n"/ >
>           </layout >  
>       </appender >  
>  
>       <appender  name="ASYNC"  class="org.apache.log4j.AsyncAppender" >
>           <appender-ref  ref="event_file"/ >
>           <appender-ref  ref="error_file"/ >
>       </appender >
>  
>       <!--  Setup  the  Root  category  -- >
>       <root >
>           <appender-ref  ref="ASYNC"/ >
>       </root >
>  
>   </log4j:configuration >
>  
>  
>  
>  -----Original  Message-----
>  From:  Dennis  Lundberg  [mailto:[hidden email]]  
>  Sent:  Tuesday,  June  13,  2006  5:04  PM
>  To:  Jakarta  Commons  Users  List
>  Subject:  Re:  turning  on  debugging  with  commons  logging
>  
>  Darren  Hall  wrote:
> >  Thanks  Dennis,
> >
> >  I'm  using  Struts  "out  of  the  box"  so  I  have  no  logging  package  in  place.
> >  I  have  no  commons-logging.properties  file  and  nothing  referring  to  Log4J
>  or
> >  anything  of  the  sort.
> >
> >  It  seems  to  me  that  commons-logging  is  using  the  Tomcat  default  logging
> >  (thus  it  outputs  to  'catalina.log').
> >
> >  I've  gone  ahead  and  downloaded  Log4J  and  included  the  Log4J.jar  file  in  my
> >  WEB-INF/lib  directory  when  deploying  my  webapp.  I've  also  created  a
> >  commons-logging.properties  file  (below)  that  I  found  as  an  example  online.
> >
> >  #########################
> >
> >  #
> >  #  $Id:  commons-logging.properties,v  1.0  2006/06/31  14:35:33Z  dhall  $
> >  #  
> >
> >  #  
> >  #  This  file  controls  which  logging  package  the  Jakarta  Commons  Logging
> >  package
> >  #  uses.  This  can  be  changed  to  point  to  any  supported  logging  package.  See
> >  #  http://jakarta.apache.org/commons/logging  for  a  list  of  supported
>  logging
> >  #  packages.
> >  #  
> >
>  org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jF
> >  actory
> >
> >  #########################
> >
> >  However,  when  I  try  to  deploy  my  war  file  in  Tomcat  I  now  get  a
> >  ClassDefNotFound  org.apache.commons.logging.impl.Log4jFactory  error.
> >
> >  On  the  commons-logging  website,  I  see  that  Log4jFactory  is  deprecated  and
> >  not  included  in  commons-logging  1.1  and  beyond.
>  
>  You  should  use  this  line  instead:
>  org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
>  
> >  How  do  I  tell  commons-logging  to  use  Log4j  (or  do  I  not  tell  it  since  it
> >  looks  for  it  by  default)?
>  
>  It's  better  to  specify  the  logging  implementation,  if  you  want  to  be  in  
>  control.  Otherwise  the  logging  implementation  chosen  by  commons-logging  
>  might  differ,  for  example  on  different  servers  like  development  and  
>  production.
>  
> >  Thanks,
> >
> >  Darren
> >
> >
> >
> >  -----Original  Message-----
> >  From:  Dennis  Lundberg  [mailto:[hidden email]]  
> >  Sent:  Tuesday,  June  13,  2006  2:41  PM
> >  To:  Jakarta  Commons  Users  List
> >  Subject:  Re:  turning  on  debugging  with  commons  logging
> >
> >  Darren  Hall  wrote:
> > >  Greeting  all,
> > >
> > >    
> > >
> > >  I'm  having  a  hard  time  turning  on  debugging  in  Apache  struts  (which  is
> >  using
> > >  commons  logging).
> > >
> > >  I  know  this  should  be  easy  to  do,  however  I'm  having  a  hard  time  finding
> >  the
> > >  information  on  the  web.
> > >
> > >  Can  anyone  here  tell  me  how  to  configure  commons  logging  so  that  it  will
> > >  display  DEBUG  level  statements,  please  (currently  it  displays  on  INFO
> >  level
> > >  and  above)?
> >  This  all  depends  on  what  underlying  logging  implementation  that  your  app  
> >  or  Struts  is  using.  I  haven't  used  Struts  myself,  so  cannot  comment  on  
> >  how  to  configure  Struts.
> >
> >  The  general  user  guide  for  commons-logging  is  here:
> >  http://jakarta.apache.org/commons/logging/commons-logging-1.1/guide.html
> >
> >  If  your  app  is  using  SimpleLog  then  this  is  the  good  place  to  look:
> >
>  http://jakarta.apache.org/commons/logging/apidocs/org/apache/commons/logging
> >  /impl/SimpleLog.html
> >
> >  If  your  app  is  using  JDK  logging  (if  you  are  running  on  Java  1.4+)  you  
> >  should  consult  the  documentation  for  the  JDK.
> >
> >
>  
>  

---------------------------------------------------------------------
To  unsubscribe,  e-mail:  [hidden email]
For  additional  commands,  e-mail:  [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re[2]: turning on debugging with commons logging

Christian Hufgard
Hi Folks,

> I don't use Apache Struts, but I think copying the
> log4j.properties to WEB-INF should be OK.

Put it into WEB-INF/classes, then it should be found.

> log4j.appender.FILE.File=output.log

This whould create a file named output.log relativly to the directory
from where you started your webserver. It might be better to use a fix
location like /logs/output.log or write to logs/output.log, which
might be a symlink to a apropriate logging directory.

Hope this helps.

Christian


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]