Log4j configuration

2010-07-28 Thread mokader

Hi,

I am adding logging enhancement to my app. There is already a log4j wrapper
is available in my app. But the existing is in jar and I can not modify. The
problem is, now I have two log4j.xml file. one for my enhancement and other
for existing one.

I first initialize existing log4j wrapper, it uses
DOMConfigurator.configure(initUrl) to configure. After this I call my new
APIs, I follow the same DOMConfigurator.configure(initUrl) to override the
configuration.

The problem here is, I have custom appender, which I specified in log4j.xml
of my enhancement, but the custom appender is called twice - once from
existing APIs and another from my APIs. 

I dont know how log4j is invoking my custom appeder, when existing APIs are
initialized. I looked this from stack trace.
-- 
View this message in context: 
http://old.nabble.com/Log4j-configuration-tp29285028p29285028.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Log4j configuration

2010-07-28 Thread Jacob Kjome
Log4j configuration is cumulative.  One call to configure() does not override 
another.  Instead, the configurations are combined.  Each time you configure() 
on a config file that defines an appender, a new one will be added rather than 
blow away the old one.  Therefore you get duplicate logging as more than one 
appender is active.


That said, it seems like this behavior was configurable?  Or maybe we merely 
discussed it a while back since the default behavior is somewhat surprising to 
users?  Maybe one of the other Log4j developers recalls this discussion and 
can provide details?



Jake


On Wed, 28 Jul 2010 03:17:25 -0700 (PDT)
 mokader moka...@cisco.com wrote:


Hi,

I am adding logging enhancement to my app. There is already a log4j wrapper
is available in my app. But the existing is in jar and I can not modify. The
problem is, now I have two log4j.xml file. one for my enhancement and other
for existing one.

I first initialize existing log4j wrapper, it uses
DOMConfigurator.configure(initUrl) to configure. After this I call my new
APIs, I follow the same DOMConfigurator.configure(initUrl) to override the
configuration.

The problem here is, I have custom appender, which I specified in log4j.xml
of my enhancement, but the custom appender is called twice - once from
existing APIs and another from my APIs. 


I dont know how log4j is invoking my custom appeder, when existing APIs are
initialized. I looked this from stack trace.
--
View this message in context: 
http://old.nabble.com/Log4j-configuration-tp29285028p29285028.html

Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org





-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Log4j configuration

2010-07-28 Thread mokader

Thanks Jake,

Is there any way to override the configuration or remove the existing
appenders.

would the  call to LogManager.shutdown()and then
DOMConfigurator.configure(initUrl) work. 

Thanks in advance,
Mohammed
 

Jacob Kjome wrote:
 
 Log4j configuration is cumulative.  One call to configure() does not
 override 
 another.  Instead, the configurations are combined.  Each time you
 configure() 
 on a config file that defines an appender, a new one will be added rather
 than 
 blow away the old one.  Therefore you get duplicate logging as more than
 one 
 appender is active.
 
 That said, it seems like this behavior was configurable?  Or maybe we
 merely 
 discussed it a while back since the default behavior is somewhat
 surprising to 
 users?  Maybe one of the other Log4j developers recalls this discussion
 and 
 can provide details?
 
 
 Jake
 
 
 On Wed, 28 Jul 2010 03:17:25 -0700 (PDT)
   mokader moka...@cisco.com wrote:
 
 Hi,
 
 I am adding logging enhancement to my app. There is already a log4j
 wrapper
 is available in my app. But the existing is in jar and I can not modify.
 The
 problem is, now I have two log4j.xml file. one for my enhancement and
 other
 for existing one.
 
 I first initialize existing log4j wrapper, it uses
 DOMConfigurator.configure(initUrl) to configure. After this I call my new
 APIs, I follow the same DOMConfigurator.configure(initUrl) to override
 the
 configuration.
 
 The problem here is, I have custom appender, which I specified in
 log4j.xml
 of my enhancement, but the custom appender is called twice - once from
 existing APIs and another from my APIs. 
 
 I dont know how log4j is invoking my custom appeder, when existing APIs
 are
 initialized. I looked this from stack trace.
 -- 
 View this message in context: 
http://old.nabble.com/Log4j-configuration-tp29285028p29285028.html
 Sent from the Log4j - Users mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org
 
 
 
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Log4j-configuration-tp29285028p29289033.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Log4j configuration

2010-07-28 Thread Jacob Kjome

On Wed, 28 Jul 2010 10:27:24 -0700 (PDT)
 mokader moka...@cisco.com wrote:


Thanks Jake,

Is there any way to override the configuration or remove the existing
appenders.



Yes, appenders can be removed manually by traversing the logging API.  But, 
again, it seems like there was some way to tell Log4j not to be cumulative (at 
least I hope so).  Hopefully someone else can shed light on this possibility.



would the  call to LogManager.shutdown()and then
DOMConfigurator.configure(initUrl) work. 


I've never tested it.  You should try it and report results.

Jake



Thanks in advance,
Mohammed


Jacob Kjome wrote:


Log4j configuration is cumulative.  One call to configure() does not
override 
another.  Instead, the configurations are combined.  Each time you
configure() 
on a config file that defines an appender, a new one will be added rather
than 
blow away the old one.  Therefore you get duplicate logging as more than
one 
appender is active.


That said, it seems like this behavior was configurable?  Or maybe we
merely 
discussed it a while back since the default behavior is somewhat
surprising to 
users?  Maybe one of the other Log4j developers recalls this discussion
and 
can provide details?



Jake


On Wed, 28 Jul 2010 03:17:25 -0700 (PDT)
  mokader moka...@cisco.com wrote:


Hi,

I am adding logging enhancement to my app. There is already a log4j
wrapper
is available in my app. But the existing is in jar and I can not modify.
The
problem is, now I have two log4j.xml file. one for my enhancement and
other
for existing one.

I first initialize existing log4j wrapper, it uses
DOMConfigurator.configure(initUrl) to configure. After this I call my new
APIs, I follow the same DOMConfigurator.configure(initUrl) to override
the
configuration.

The problem here is, I have custom appender, which I specified in
log4j.xml
of my enhancement, but the custom appender is called twice - once from
existing APIs and another from my APIs. 


I dont know how log4j is invoking my custom appeder, when existing APIs
are
initialized. I looked this from stack trace.
--
View this message in context: 
http://old.nabble.com/Log4j-configuration-tp29285028p29285028.html

Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org





-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org





--
View this message in context: 
http://old.nabble.com/Log4j-configuration-tp29285028p29289033.html

Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org





-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: problem using Chainsaw, found non matching line

2010-07-28 Thread Scott Deboy
Florian's locale is French, so simpledateformat is constructing timestamps
with a dot in the month, which the regular expression wasn't taking into
account in LogFilePatternReceiver...I've committed a fix to the receivers
companion in svn 980277 and I've uploaded a version of Chainsaw with the fix
to http://people.apache.org/~sdeboy/

Feedback appreciated.

Scott

On Tue, Jul 27, 2010 at 1:36 AM, Florian Boulay f.mail.l...@gmail.comwrote:

 Hi Scott,

 Thnaks for finding this bug, but unfortunately the last release does not
 fix
 the issue. I tried with a LogFilePatternReceiver and with theses 2 formats
 :
 - [TIMESTAMP] [LEVEL] user: [PROP(*)] LOGGER | MESSAGE
 - [TIMESTAMP] [LEVEL] user: [PROP(USER)] LOGGER | MESSAGE

 Another bug : when loading the Chainsaw config file the parameter name
 (param name=name value=App Dev/) does not seem to considered. Instead
 the name of the displayed receiver is logFileReceiver.

 I am still searching why this does not work.

 2010/7/27 Scott Deboy scott.de...@gmail.com

  I've committed a fix to the regexp building logic to correctly escape
  regexp
  characters (including the pipe character) in svn 979552.
 
  I've also uploaded a new chainsaw standalone.zip to
  http://people.apache.org/~sdeboy/ http://people.apache.org/%7Esdeboy/
 http://people.apache.org/%7Esdeboy/
 
  I was able to parse a log file with your provided patternlayout using:
 
param name=timestampFormat value=dd MMM  HH:mm:ss,SSS/
param name=logFormat value=[TIMESTAMP] [LEVEL] user:
 [PROP(USER)]
  LOGGER | MESSAGE/
 
  I also tested greater than and less than symbols as delimiters and they
  work
  fine, but you have to use a layout which uses the encoded symbols in the
  xml
  config file:
 
param name=logFormat value=lt;TIMESTAMPgt; lt;LEVELgt;
 user:
  lt;PROP(USER)gt; LOGGER | MESSAGE/
 
  You may want to use
 org.apache.log4j.chainsaw.vfs.VFSLogFilePatternReceiver
  instead - it more reliably tails, and can tail files using any of the
 file
  systems supported by Jakarta Commons-VFS (including tailing over ssh).
  Changing the receiver class name should be all you need to do to use it..
 
  Let me know if the latest standalone zip file works for you.
 
  Scott
 
  On Mon, Jul 26, 2010 at 1:55 AM, Florian Boulay 
 florian.bou...@gmail.com
  wrote:
 
   When using the format *[TIMESTAMP] **, the updated version of Chainsaw
   manages to parse 4 lines of my log file. The old version does not
 manage
  to
   do it.
   However the *** get a lot of lines ! It does not stop when it
 encounters
  a
   \r\n
  
   2010/7/26 Florian Boulay florian.bou...@gmail.com
  
Ok I answered to quickly. The updated version still parses my log
 file,
   but
it always display : found non matching line:...
   
2010/7/26 Florian Boulay florian.bou...@gmail.com
   
Hi,
   
I tried the format [TIMESTAMP] [LEVEL] * LOGGER | MESSAGE with the
official version of Chainsaw and the updated version found here :
http://people.apache.org/~sdeboy/http://people.apache.org/%7Esdeboy/
 http://people.apache.org/%7Esdeboy/
  http://people.apache.org/%7Esdeboy/
   http://people.apache.org/%7Esdeboy/and It did not work.
   
On the updated version, nothing happen when choosing my chainsaw
 confg
file. No error message in the tab chainsaw-log. Sound like it did
  not
parse any file. I also tried to delete all files in my .chainsaw
   directory,
but it does not change the behavior of Chainsaw. Maybe I should try
  with
   a
SocketAppender instead of loading a local file.
   
2010/7/26 Scott Deboy scott.de...@gmail.com
   
Can you try
[TIMESTAMP] [LEVEL] * LOGGER | MESSAGE
   
Also, try the updated version of Chainsaw when you have a chance
 and
   see
if that resolves your issue.
   
Scott
   
   
   
   
On Jul 26, 2010, at 12:25 AM, Florian Boulay 
  florian.bou...@gmail.com
   
wrote:
   
 Hello,
   
These two formats do not work :
- [TIMESTAMP] [LEVEL] user:[PROP(USER)] LOGGER | MESSAGE
- [TIMESTAMP] [LEVEL] user:[*] LOGGER | MESSAGE
   
I am still searching the right format, I tried just '*' and it
 still
does
not work
   
2010/7/23 Scott Deboy scott.de...@gmail.com
   
 Try:
[TIMESTAMP] [LEVEL] user:[PROP(USER)] LOGGER | MESSAGE
   
Or, if you don't want the user property defined (you probably
 still
want
the
logger, yes?)
[TIMESTAMP] [LEVEL] user:[*] LOGGER | MESSAGE
   
   
On Fri, Jul 23, 2010 at 9:15 AM, Florian Boulay 
florian.bou...@gmail.com
   
wrote:
   
   
 Hello,
   
Since 2 days, I am trying to configure Chainsaw v2 for parsing
 my
log4j
   
log
   
files, but it always returns found non matching line
   
Here is my log4j configuration :
appender name=crm
class=org.apache.log4j.DailyRollingFileAppender

 layout class=org.apache.log4j.PatternLayout
 param 

catalina.out flooded

2010-07-28 Thread Johan Martinez
A webapp is flooding tomcat's catalina.out file and I would like to verify
if there is something wrong with my log4j configuration. Below is the
configuration I have in WEB-INF/classes/log4j.properties of the webapp. Any
suggestions or thoughts on what might be wrong with it??  I suspect logs are
getting duplicated in catalina.out and following log4j-defined files, but I
am not 100% sure on this (difficult to verify due to large file sizes).

Thanks,
jM.

log4j
# Set root category priority to WARN and its only appender to A1.

log4j.rootCategory=ERROR, A1

# A1 is set to be a ConsoleAppender.

log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{ABSOLUTE} %-5p %c{2}
[%t,%M:%L] %m%n

# Display any warnings generated by our code
log4j.category.org.ca=INFO

# ApacheLogs Appender
log4j.appender.ApacheLogs=org.apache.log4j.DailyRollingFileAppender
log4j.appender.ApacheLogs.File=${catalina.home}/logs/apache.log
log4j.appender.ApacheLogs.Append=true
log4j.appender.ApacheLogs.layout=org.apache.log4j.PatternLayout
log4j.appender.ApacheLogs.DatePattern='.'--MM-DD
log4j.appender.ApacheLogs.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}%L
%m%n

# GlobusLogs Appender
log4j.appender.GlobusLogs=org.apache.log4j.DailyRollingFileAppender
log4j.appender.GlobusLogs.File=${catalina.home}/logs/wsrf.log
log4j.appender.GlobusLogs.Append=true
log4j.appender.GlobusLogs.layout=org.apache.log4j.PatternLayout
log4j.appender.GlobusLogs.DatePattern='.'--MM-DD
log4j.appender.GlobusLogs.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}%L
%m%n

# Define loggers
log4j.logger.org.apache=info,ApacheLogs
log4j.logger.org.apache.axis=debug,ApacheLogs

log4j.category.org.globus=INFO,GlobusLogs
log4j.logger.org.globus.wsrf.handlers.MessageLoggingHandler=DEBUG,GlobusLogs

/log4j


Re: catalina.out flooded

2010-07-28 Thread Jacob Kjome
Well, you have some specific loggers set to INFO and DEBUG.  Which loggers are
causing the excessive output?  I suspect the following definitions...

log4j.logger.org.apache=info,ApacheLogs
log4j.logger.org.apache.axis=debug,ApacheLogs

If you really want all the apache libraries logging at the info level, and the
Axis library logging at the debug level (yikes), but you don't want your console
log flooded with messages from these loggers, then set additivity to false.

log4j.additivity.org.apache=false

No need to do this specifically for the Axis logger, as additivity to the root
logger will have been cut off at its parent org.apache logger.


Jake


On 7/28/2010 7:41 PM, Johan Martinez wrote:
 A webapp is flooding tomcat's catalina.out file and I would like to verify
 if there is something wrong with my log4j configuration. Below is the
 configuration I have in WEB-INF/classes/log4j.properties of the webapp. Any
 suggestions or thoughts on what might be wrong with it??  I suspect logs are
 getting duplicated in catalina.out and following log4j-defined files, but I
 am not 100% sure on this (difficult to verify due to large file sizes).
 
 Thanks,
 jM.
 
 log4j
 # Set root category priority to WARN and its only appender to A1.
 
 log4j.rootCategory=ERROR, A1
 
 # A1 is set to be a ConsoleAppender.
 
 log4j.appender.A1=org.apache.log4j.ConsoleAppender
 
 # A1 uses PatternLayout.
 log4j.appender.A1.layout=org.apache.log4j.PatternLayout
 log4j.appender.A1.layout.ConversionPattern=%d{ABSOLUTE} %-5p %c{2}
 [%t,%M:%L] %m%n
 
 # Display any warnings generated by our code
 log4j.category.org.ca=INFO
 
 # ApacheLogs Appender
 log4j.appender.ApacheLogs=org.apache.log4j.DailyRollingFileAppender
 log4j.appender.ApacheLogs.File=${catalina.home}/logs/apache.log
 log4j.appender.ApacheLogs.Append=true
 log4j.appender.ApacheLogs.layout=org.apache.log4j.PatternLayout
 log4j.appender.ApacheLogs.DatePattern='.'--MM-DD
 log4j.appender.ApacheLogs.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}%L
 %m%n
 
 # GlobusLogs Appender
 log4j.appender.GlobusLogs=org.apache.log4j.DailyRollingFileAppender
 log4j.appender.GlobusLogs.File=${catalina.home}/logs/wsrf.log
 log4j.appender.GlobusLogs.Append=true
 log4j.appender.GlobusLogs.layout=org.apache.log4j.PatternLayout
 log4j.appender.GlobusLogs.DatePattern='.'--MM-DD
 log4j.appender.GlobusLogs.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}%L
 %m%n
 
 # Define loggers
 log4j.logger.org.apache=info,ApacheLogs
 log4j.logger.org.apache.axis=debug,ApacheLogs
 
 log4j.category.org.globus=INFO,GlobusLogs
 log4j.logger.org.globus.wsrf.handlers.MessageLoggingHandler=DEBUG,GlobusLogs
 
 /log4j
 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org