two log4j repository?

2004-11-15 Thread Zhu Qifei
Hi all, Can i have two separate log4j repository in one JVM? Thanks a lot! Regards Qifei - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Create different file for each session

2004-11-15 Thread Chiming Huang
Thank you all for the information. - Original Message - From: "Paul Smith" <[EMAIL PROTECTED]> To: "Log4J Users List" <[EMAIL PROTECTED]> Sent: Monday, November 15, 2004 4:42 PM Subject: RE: Create different file for each session > Not to blow our own horns (ok, maybe a little) but wha

dealing with CMT in Database Appender

2004-11-15 Thread Lutz Michael
How does Log4j's database appender deal with Container Managed Transactions? Specifically, how does the database appender prevent the container from rolling back logging entries as part of the business transaction that might be rolling back due to a SQL failure? Mike ___

RE: How to determine if log4j has been configured

2004-11-15 Thread Paul Smith
I believe log4j1.3 has LoggerRepository.isPristine() which will tell you that, but that's not available in the 1.2.8 release. The only way I could think of doing it is doing as you suggest, and analyzing any attached appenders, or checking for any logger in the hierachy that has a non-null Level,

RE: Create different file for each session

2004-11-15 Thread Paul Smith
Not to blow our own horns (ok, maybe a little) but what about Chainsaw? http://logging.apache.org/log4j/docs/chainsaw.html You can do all sorts of filtering on it, in real-time, or offline. Anyway, even as one of the developers, I still use good ole fashion grep from time to time. I use MDC for

RE: multiple logger hierarchies

2004-11-15 Thread Paul Smith
This could be overkill, but could we defensively protect against this with a one-shot latch? Probably adds more burden, but would be safer and clearer to the user to throw a RuntimeException should they use it a second time. This is very edge case though, I guess. > -Original Message- >

RE: How to determine if log4j has been configured

2004-11-15 Thread Dave . Derry
Yoav, Thanks for the tip. I looked at that code, and see that the main difference seems to be testing for the appender enumeration being null, or NullEnumeration. I'm wondering, this seems to work only if there isn't a log4j.xml/.properties on the classpath? I found that the reason I got FILE

Re: best practice question: webapp relative filenames in FileAppenders

2004-11-15 Thread Jacob Kjome
Quoting Eric Bloch <[EMAIL PROTECTED]>: > Jacob, > > This does sound like the right approach, thanks! (although system > properties will cause me problems in containers that have security > policies...and I'd need to call out this property as settable). > Yes, but since the property name is predi

Re: best practice question: webapp relative filenames in FileAppenders

2004-11-15 Thread Eric Bloch
Jacob, This does sound like the right approach, thanks! (although system properties will cause me problems in containers that have security policies...and I'd need to call out this property as settable). Do you know if the servlet spec guarentee that the log4j properties file will be loaded *af

logger levels

2004-11-15 Thread roy-log4j-user
Hi guys, Okay... I looked in documentation, googled and search the mailing list. For some reason I can't figure out how to set the levels per logger in xml. Like in a properties file, you could do: log4j.logger.com.mycompany.mypackage=DEBUG I can't find anywhere that tells me how to do this wi

RE: disabling autoconfiguration

2004-11-15 Thread Shapira, Yoav
Hi, >Would a system property be useful here? A lightbulb went on when I read that, followed by a smack to the side of my head: there's already one! Setting the system property log4j.defaultInitOverride overrides the default init procedure. This is documented in the short manual. OP: give it a

Re: disabling autoconfiguration

2004-11-15 Thread Eric Bloch
Would a system property be useful here? -Eric Shapira, Yoav wrote: Hi, Given the fact autoconfiguration runs in a static initializer, it only seems possible to circumvent with a custom classloader. It's a lot less effort to simply not have log4j.properties/log4j.xml on the classpath than it is t

RE: disabling autoconfiguration

2004-11-15 Thread Shapira, Yoav
Hi, Given the fact autoconfiguration runs in a static initializer, it only seems possible to circumvent with a custom classloader. It's a lot less effort to simply not have log4j.properties/log4j.xml on the classpath than it is to start mucking with custom loaders for this purpose. So no, I d

Re: disabling autoconfiguration

2004-11-15 Thread Ricardo Trindade
But do you think it would be possible / usefull ? thanks Ricardo Ceki Gülcü wrote: Auto-configuration occurs when the log4j classes are loaded into memory. It is not dependent on any particular configurator. At 05:07 PM 11/15/2004, Ricardo Trindade wrote: Well, this could be simplistic, but perha

RE: Create different file for each session

2004-11-15 Thread Scott Deboy
Use log4j's Chainsaw (http://logging.apache.org/log4j/docs/chainsaw.html) configured to load your log file using a LogFilePatternReceiver (construct a new LogFilePatternReceiver from the receiver panel in Chainsaw). If you have the userID available as a property (MDC entry), you can filter dyn

RE: How to determine if log4j has been configured

2004-11-15 Thread Shapira, Yoav
Hi, This wiki page has code to determine whether log4j has been configured or not: http://wiki.apache.org/logging-log4j/UsefulCode. It is good practice to use this or similar code instead of always calling Configurator#configure. Your detection code is somewhat close (more in spirit) of the abov

Re: disabling autoconfiguration

2004-11-15 Thread Ceki Gülcü
Auto-configuration occurs when the log4j classes are loaded into memory. It is not dependent on any particular configurator. At 05:07 PM 11/15/2004, Ricardo Trindade wrote: Well, this could be simplistic, but perhaps : JoranConfigurator logConfigurator = new JoranConfigurator(); -> current behav

Re: disabling autoconfiguration

2004-11-15 Thread Ricardo Trindade
Well, this could be simplistic, but perhaps : JoranConfigurator logConfigurator = new JoranConfigurator(); -> current behaviour JoranConfigurator logConfigurator = new JoranConfigurator( boolean autoinit ); -> user can specify if auto-init occurs thanks Ricardo Ceki Gülcü wrote: How do you sugge

How to determine if log4j has been configured

2004-11-15 Thread Dave . Derry
I have a number of applications that all derive from a common base class. They also share a log4j.properties file. Because having multiple applications (running in seperate VMs) writing to the same log file is disasterous, I configure log4j in the ctor by calling the property configurator:

Re: disabling autoconfiguration

2004-11-15 Thread Ceki Gülcü
How do you suggest the automatic configuration feature be turned off. More specifically, how do you think the user pass this instruction to log4j? At 03:26 PM 11/15/2004, Ricardo Trindade wrote: Thanks, Could I suggest it for a future version, then ? Libraries sometimes bundle these files, ma

Re: Create different file for each session

2004-11-15 Thread Chiming Huang
Thank you for the answer. Just out of curious, is it normal to log everything in one file for all users? If needs trouble shooting later, is there a better tool to extract the related log entries for a specific user, time ...,etc? Thanks, Chiming - Original Message - From: "Jacob Kj

Re: disabling autoconfiguration

2004-11-15 Thread Ricardo Trindade
Thanks, Could I suggest it for a future version, then ? Libraries sometimes bundle these files, making it hard to do custom log4j configs. thanks, Ricardo Ceki Gülcü wrote: At 01:38 PM 11/15/2004, Ricardo Trindade wrote: Hi, Is there a way to disable the automatic configuration ? No there

Re: disabling autoconfiguration

2004-11-15 Thread Ceki Gülcü
At 01:38 PM 11/15/2004, Ricardo Trindade wrote: Hi, Is there a way to disable the automatic configuration ? No there is not. If there is a config file named log4j.xml or log4j.properties, the former file having priority over the latter, log4j assumes that the user wants automatic configuratio

Re: multiple logger hierarchies

2004-11-15 Thread Ceki Gülcü
At 12:50 PM 11/15/2004, Ricardo Trindade wrote: Thanks, worked like a charm. I only needed to make another slight modification,that was to create a different JoranConfigurator for each repository. thanks Ricardo Correct. JoranConfigurator objects are not meant to be long-lived. A JoranConf

disabling autoconfiguration

2004-11-15 Thread Ricardo Trindade
Hi, Is there a way to disable the automatic configuration ? I looked in the faqs, but couldn't find it. My problem is that some libs I use bundle log4j.properties (for example jboss client). thanks Ricardo - To unsubscribe,

Re: multiple logger hierarchies

2004-11-15 Thread Ricardo Trindade
Thanks, worked like a charm. I only needed to make another slight modification,that was to create a different JoranConfigurator for each repository. thanks Ricardo Ceki Gülcü wrote: Hello Rocardo, It looks good, except one small detail: change org.apache.log4j.Logger logger = org.apache.l

Re: multiple logger hierarchies

2004-11-15 Thread Ceki Gülcü
Hello Rocardo, It looks good, except one small detail: change org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("log"); to org.apache.log4j.Logger logger = new org.apache.log4j.spi.RootLogger(Level.DEBUG); HTH, At 09:52 AM 11/15/2004, Ricardo Trindade wrote: Hi, I'm trying t

Re: multiple logger hierarchies

2004-11-15 Thread Ricardo Trindade
Forgot to mention that I'm using log4j-1.3, with a CVS checkout about 1 month ago. thanks Ricardo Ricardo Trindade wrote: Hi, I'm trying to configure multiple logger hierarchies, and having a bit of trouble. I tried the following : JoranConfigurator logConfigurator = new JoranConfi

multiple logger hierarchies

2004-11-15 Thread Ricardo Trindade
Hi, I'm trying to configure multiple logger hierarchies, and having a bit of trouble. I tried the following : JoranConfigurator logConfigurator = new JoranConfigurator(); InputStream logConfig = getClass().getResourceAsStream("log4j.xml"); org.apache.log4j.Logger logger