RE: using log4j to one logging file from more than one process
Hello, I followed the approach using a SocketAppender now. I am starting a SocketServer via the following commandline: java org.apache.log4j.net.SocketServer port configFile configDir I have incorporated this commandline in the script that also starts my other 3 processes. 1) Do you know if there is some commandline interface that can be used to stop the socket server? 2) Or is there only the possibility to kill the socketserver process? -Original Message- From: Keith Hatton [mailto:[EMAIL PROTECTED] Sent: Montag, 26. Juli 2004 17:04 To: Log4J Users List Subject: RE: using log4j to one logging file from more than one process You might also consider using system-level logging (e.g. with NTEventLogAppender or SyslogAppender, depending on the platform) or a SocketAppender from each application to a listener in a fourth JVM on the box. Keith -Original Message- From: Dennis Cook [mailto:[EMAIL PROTECTED] Sent: 26 July 2004 15:59 To: Log4J Users List Subject: Re: using log4j to one logging file from more than one process Here is one approach that might work. If the three processes can be started by a single common java process, then you could use console appenders from those three processes and collect there entries in the starting process by intercepting their stdout and stderr streams; in turn writing to a file appender from that process. On Jul 26, 2004, at 7:35 AM, Bartsch Axel wrote: Hello, I want to write into a logging file with log4j from an application that consists of 3 processes (=JAVA VMs). Each process calls String configFileName = log.properties; PropertyConfigurator.configure(configFileName); tfl = Logger.getLogger(debug); and then logs e.g. with tfl.debug(hello); The loggging file gets corrupted: - each process writes into it, after a while 0Hex whitespace is added to the logging file - there is output-process1, whitespace, output-process2, whitespace, output-process3, whitespace - some trace outputs are missing -timestamps start new with each output-processX Is it possible to use log4j for wrting into the same file for multiple processes (=JAVA VMs). Axel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Decorating output before RollingFileAppender
I want to format and modify my log4j output prior to sending to a RollingFileAppender. If there were functionality that would allow me to easily apply a PatternLayout prior to sending to a RollingFileAppender that would be ideal. I can insert an AsyncAppender before my RollingFileAppender, but AsyncAppender does not take a PatternLayout parameter so it doesn't help. In fact, the only two appenders that take PatternLayout arguments are the *FileAppender's and ConsoleAppender. Is there a simple way to decorate my output with a PatternLayout (or some similar functionality) prior to its arrival in a RollingFileAppender? Thanks in advance, Frank __ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Decorating output before RollingFileAppender
RollingFileAppender extends FileAppender so it takes a PatternLayout also. James Stauffer -Original Message- From: F Kurzawa [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 10:55 AM To: Log4J Users List Subject: Decorating output before RollingFileAppender I want to format and modify my log4j output prior to sending to a RollingFileAppender. If there were functionality that would allow me to easily apply a PatternLayout prior to sending to a RollingFileAppender that would be ideal. I can insert an AsyncAppender before my RollingFileAppender, but AsyncAppender does not take a PatternLayout parameter so it doesn't help. In fact, the only two appenders that take PatternLayout arguments are the *FileAppender's and ConsoleAppender. Is there a simple way to decorate my output with a PatternLayout (or some similar functionality) prior to its arrival in a RollingFileAppender? Thanks in advance, Frank __ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Decorating output before RollingFileAppender
Hi James, Sorry I wasn't clearer. I need to be able to decorate the output BEFORE RollingFileAppender. This is because I need to have different lines laid out out differently depending on which logger that they came from. I don't have enough control with the single PatternLayout within RFA to get the different formatting that I need. The intuitively obvious approach was to use multiple RollingFileAppenders, each of which would write to the same file. But RollingFileAppender becomes very confused if other RFA's are writing to the same file, and the file starts getting rotated willy-nilly as each RFA steps on the other. So that approach won't work. Regards, Frank --- James Stauffer [EMAIL PROTECTED] wrote: RollingFileAppender extends FileAppender so it takes a PatternLayout also. James Stauffer -Original Message- From: F Kurzawa [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 10:55 AM To: Log4J Users List Subject: Decorating output before RollingFileAppender I want to format and modify my log4j output prior to sending to a RollingFileAppender. If there were functionality that would allow me to easily apply a PatternLayout prior to sending to a RollingFileAppender that would be ideal. I can insert an AsyncAppender before my RollingFileAppender, but AsyncAppender does not take a PatternLayout parameter so it doesn't help. In fact, the only two appenders that take PatternLayout arguments are the *FileAppender's and ConsoleAppender. Is there a simple way to decorate my output with a PatternLayout (or some similar functionality) prior to its arrival in a RollingFileAppender? Thanks in advance, Frank __ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Release date for log4j 1.3?
Thanks for a lovely product! I find a lot of the features announced for 1.3 very interesting. How mature is log4j 1.3 currently - and do anybody have an opinion of a sane release-date? Kind regards, David Karlsen -- David J. M. Karlsen - +47 90 68 22 43 http://www.davidkarlsen.com http://mp3.davidkarlsen.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Release date for log4j 1.3?
Hola, If I had $1 for every time we saw this question ;) I think 12 weeks for 1.3alpha0 is sane ;) Yoav Shapira Millennium Research Informatics -Original Message- From: David J. M. Karlsen [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 1:09 PM To: Log4J Users List Subject: Release date for log4j 1.3? Thanks for a lovely product! I find a lot of the features announced for 1.3 very interesting. How mature is log4j 1.3 currently - and do anybody have an opinion of a sane release-date? Kind regards, David Karlsen -- David J. M. Karlsen - +47 90 68 22 43 http://www.davidkarlsen.com http://mp3.davidkarlsen.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Decorating output before RollingFileAppender
Hi Yoav, I might be able to do what I want by extending RollingFileAppender, but a simpler solution for me would probably be to extend AsyncAppender to accept a PatternLayout parameter and then apply it before outputting to the next appender. Regardless, I was really hoping for a solution that would not require extending log4j. I was hoping there was a way to decorate log entries inline by passing them through some sort of filter, much the way that AsyncAppender acts as a filter of sorts in front of another appender. Regards, Frank --- Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, You can always extend either RollingFileAppender or PatternLayout to suit your own needs. That's a big plus of open-source and our ASF license ;) Yoav Shapira Millennium Research Informatics -Original Message- From: F Kurzawa [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 12:37 PM To: Log4J Users List Subject: RE: Decorating output before RollingFileAppender Hi James, Sorry I wasn't clearer. I need to be able to decorate the output BEFORE RollingFileAppender. This is because I need to have different lines laid out out differently depending on which logger that they came from. I don't have enough control with the single PatternLayout within RFA to get the different formatting that I need. The intuitively obvious approach was to use multiple RollingFileAppenders, each of which would write to the same file. But RollingFileAppender becomes very confused if other RFA's are writing to the same file, and the file starts getting rotated willy-nilly as each RFA steps on the other. So that approach won't work. Regards, Frank --- James Stauffer [EMAIL PROTECTED] wrote: RollingFileAppender extends FileAppender so it takes a PatternLayout also. James Stauffer -Original Message- From: F Kurzawa [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 10:55 AM To: Log4J Users List Subject: Decorating output before RollingFileAppender I want to format and modify my log4j output prior to sending to a RollingFileAppender. If there were functionality that would allow me to easily apply a PatternLayout prior to sending to a RollingFileAppender that would be ideal. I can insert an AsyncAppender before my RollingFileAppender, but AsyncAppender does not take a PatternLayout parameter so it doesn't help. In fact, the only two appenders that take PatternLayout arguments are the *FileAppender's and ConsoleAppender. Is there a simple way to decorate my output with a PatternLayout (or some similar functionality) prior to its arrival in a RollingFileAppender? Thanks in advance, Frank = Frank Kurzawa Topaz Software [EMAIL PROTECTED] __ Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. http://messenger.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Decorating output before RollingFileAppender
I have written a couple of filters that 'decorate' logging events - that may be a better route to go. See PropertyFilter and ReflectionFilter here: http://cvs.apache.org/viewcvs.cgi/jakarta-log4j/src/java/org/apache/log4 j/varia/ In particular, ReflectionFilter sets the 'renderedMessage' on the event, which would probably be what you want to do. You may want to consider relying on the Expression mechanism (see ExpressionFilter in the same package) as a flexible way to determine which events have the filter applied. I haven't worked much with PaternLayout so I'm not sure how you would use it in a filter. Scott -Original Message- From: F Kurzawa [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 10:37 AM To: Log4J Users List Subject: RE: Decorating output before RollingFileAppender Hi Yoav, I might be able to do what I want by extending RollingFileAppender, but a simpler solution for me would probably be to extend AsyncAppender to accept a PatternLayout parameter and then apply it before outputting to the next appender. Regardless, I was really hoping for a solution that would not require extending log4j. I was hoping there was a way to decorate log entries inline by passing them through some sort of filter, much the way that AsyncAppender acts as a filter of sorts in front of another appender. Regards, Frank --- Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, You can always extend either RollingFileAppender or PatternLayout to suit your own needs. That's a big plus of open-source and our ASF license ;) Yoav Shapira Millennium Research Informatics -Original Message- From: F Kurzawa [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 12:37 PM To: Log4J Users List Subject: RE: Decorating output before RollingFileAppender Hi James, Sorry I wasn't clearer. I need to be able to decorate the output BEFORE RollingFileAppender. This is because I need to have different lines laid out out differently depending on which logger that they came from. I don't have enough control with the single PatternLayout within RFA to get the different formatting that I need. The intuitively obvious approach was to use multiple RollingFileAppenders, each of which would write to the same file. But RollingFileAppender becomes very confused if other RFA's are writing to the same file, and the file starts getting rotated willy-nilly as each RFA steps on the other. So that approach won't work. Regards, Frank --- James Stauffer [EMAIL PROTECTED] wrote: RollingFileAppender extends FileAppender so it takes a PatternLayout also. James Stauffer -Original Message- From: F Kurzawa [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 10:55 AM To: Log4J Users List Subject: Decorating output before RollingFileAppender I want to format and modify my log4j output prior to sending to a RollingFileAppender. If there were functionality that would allow me to easily apply a PatternLayout prior to sending to a RollingFileAppender that would be ideal. I can insert an AsyncAppender before my RollingFileAppender, but AsyncAppender does not take a PatternLayout parameter so it doesn't help. In fact, the only two appenders that take PatternLayout arguments are the *FileAppender's and ConsoleAppender. Is there a simple way to decorate my output with a PatternLayout (or some similar functionality) prior to its arrival in a RollingFileAppender? Thanks in advance, Frank = Frank Kurzawa Topaz Software [EMAIL PROTECTED] __ Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. http://messenger.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Decorating output before RollingFileAppender
See the filter javadocs. Here's an example appender name=console class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.SimpleLayout/ filter class=org.apache.log4j.varia.ExpressionFilter param name=Expression value=logger == p1 NDC.userid == u23 / param name=AcceptOnMatch value=true/ param name=ConvertInFixToPostFix value=true/ /filter filter class=org.apache.log4j.varia.DenyAllFilter/ /appender Notice in appenderSkeleton's doAppend method, filters are processed in order. http://cvs.apache.org/viewcvs.cgi/jakarta-log4j/src/java/org/apache/log4 j/AppenderSkeleton.java?rev=1.26view=auto Scott -Original Message- From: F Kurzawa [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 11:47 AM To: Log4J Users List Subject: RE: Decorating output before RollingFileAppender This looks interesting and leaning towards what would suit me. Forgive my ignorance, but I haven't seen any examples of how to use a filter in a configuration file. Can you point me to some examples? Thanks, Frank --- Scott Deboy [EMAIL PROTECTED] wrote: I have written a couple of filters that 'decorate' logging events - that may be a better route to go. See PropertyFilter and ReflectionFilter here: http://cvs.apache.org/viewcvs.cgi/jakarta-log4j/src/java/org/apache/log4 j/varia/ In particular, ReflectionFilter sets the 'renderedMessage' on the event, which would probably be what you want to do. You may want to consider relying on the Expression mechanism (see ExpressionFilter in the same package) as a flexible way to determine which events have the filter applied. I haven't worked much with PaternLayout so I'm not sure how you would use it in a filter. Scott -Original Message- From: F Kurzawa [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 10:37 AM To: Log4J Users List Subject: RE: Decorating output before RollingFileAppender Hi Yoav, I might be able to do what I want by extending RollingFileAppender, but a simpler solution for me would probably be to extend AsyncAppender to accept a PatternLayout parameter and then apply it before outputting to the next appender. Regardless, I was really hoping for a solution that would not require extending log4j. I was hoping there was a way to decorate log entries inline by passing them through some sort of filter, much the way that AsyncAppender acts as a filter of sorts in front of another appender. Regards, Frank --- Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, You can always extend either RollingFileAppender or PatternLayout to suit your own needs. That's a big plus of open-source and our ASF license ;) Yoav Shapira Millennium Research Informatics -Original Message- From: F Kurzawa [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 12:37 PM To: Log4J Users List Subject: RE: Decorating output before RollingFileAppender Hi James, Sorry I wasn't clearer. I need to be able to decorate the output BEFORE RollingFileAppender. This is because I need to have different lines laid out out differently depending on which logger that they came from. I don't have enough control with the single PatternLayout within RFA to get the different formatting that I need. The intuitively obvious approach was to use multiple RollingFileAppenders, each of which would write to the same file. But RollingFileAppender becomes very confused if other RFA's are writing to the same file, and the file starts getting rotated willy-nilly as each RFA steps on the other. So that approach won't work. Regards, Frank --- James Stauffer [EMAIL PROTECTED] wrote: RollingFileAppender extends FileAppender so it takes a PatternLayout also. James Stauffer -Original Message- From: F Kurzawa [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 10:55 AM To: Log4J Users List Subject: Decorating output before RollingFileAppender I want to format and modify my log4j output prior to sending to a RollingFileAppender. If there were functionality that would allow me to easily apply a PatternLayout prior to sending to a RollingFileAppender that would be ideal. I can insert an AsyncAppender before my RollingFileAppender, but AsyncAppender does not take a PatternLayout parameter so it doesn't help. In fact, the only two appenders that take PatternLayout arguments are the *FileAppender's and ConsoleAppender. Is there a simple way to decorate my output with a PatternLayout (or some similar functionality) prior to its arrival in a RollingFileAppender? Thanks in advance, Frank = Frank Kurzawa Topaz Software [EMAIL PROTECTED] __ Do you Yahoo!? Y! Messenger - Communicate
How to add new level
Hi, How can i add new level to log4j? Thanks _ Share a single photo or an entire photo slide show right inside MSN® Messenger. http://join.msn.com/?pgmarket=en-capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to add new level
Thanks, i 've already found this link but i dont know what values to give to TRACE_INT and SYSLOG_TRACE_INT they used 800 an d7 but in my case, i need this level, to be able to call logger.levelName(--); and in the log4j xml file send email to certain group each time levelName is called. From: Paul Smith [EMAIL PROTECTED] Reply-To: Log4J Users List [EMAIL PROTECTED] To: 'Log4J Users List' [EMAIL PROTECTED] Subject: RE: How to add new level Date: Wed, 28 Jul 2004 08:12:43 +1000 http://wiki.apache.org/logging-log4j/TraceLevel -Original Message- From: yacout dadoun [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 8:03 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: How to add new level Hi, How can i add new level to log4j? Thanks _ Share a single photo or an entire photo slide show right inside MSNR Messenger. http://join.msn.com/?pgmarket=en- capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market_ MSNIS_Taglines Start enjoying all the benefits of MSNR Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Take advantage of powerful junk e-mail filters built on patented Microsoft® SmartScreen Technology. http://join.msn.com/?pgmarket=en-capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to add new level
You won't be able to call logger.levelName because unless you come up with your own LoggerFactory implementation, which is not recommended but possible. The usual way of using your custom level is to use the Logger.log(Level level, Object message) method. The numbers used are for comparing Levels with each other, so your custom Level should have a number that places it, say, below DEBUG, or between INFO WARN. It's really up to you and what your Level is all about. To reference your custom level in the configuration file, you use the syntax that is at the very bottom of the example I sent: trace#my.package.TraceLevel e.g: log4j.rootLogger=trace#my.package.TraceLevel, MAIN, STDERR -Original Message- From: yacout dadoun [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 8:28 AM To: [EMAIL PROTECTED] Subject: RE: How to add new level Thanks, i 've already found this link but i dont know what values to give to TRACE_INT and SYSLOG_TRACE_INT they used 800 an d7 but in my case, i need this level, to be able to call logger.levelName(--); and in the log4j xml file send email to certain group each time levelName is called. From: Paul Smith [EMAIL PROTECTED] Reply-To: Log4J Users List [EMAIL PROTECTED] To: 'Log4J Users List' [EMAIL PROTECTED] Subject: RE: How to add new level Date: Wed, 28 Jul 2004 08:12:43 +1000 http://wiki.apache.org/logging-log4j/TraceLevel -Original Message- From: yacout dadoun [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 8:03 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: How to add new level Hi, How can i add new level to log4j? Thanks _ Share a single photo or an entire photo slide show right inside MSNR Messenger. http://join.msn.com/?pgmarket=en- capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market _ MSNIS_Taglines Start enjoying all the benefits of MSNR Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Take advantage of powerful junk e-mail filters built on patented MicrosoftR SmartScreen Technology. http://join.msn.com/?pgmarket=en- capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market_ MSNIS_Taglines Start enjoying all the benefits of MSNR Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to add new level
Thanks for ur help To reference your custom level in the configuration file, you use the syntax that is at the very bottom of the example I sent: trace#my.package.TraceLevel e.g: log4j.rootLogger=trace#my.package.TraceLevel, MAIN, STDERR But how to add it to the xml log4j file not properties file ? From: Paul Smith [EMAIL PROTECTED] Reply-To: Log4J Users List [EMAIL PROTECTED] To: 'Log4J Users List' [EMAIL PROTECTED] Subject: RE: How to add new level Date: Wed, 28 Jul 2004 08:36:57 +1000 You won't be able to call logger.levelName because unless you come up with your own LoggerFactory implementation, which is not recommended but possible. The usual way of using your custom level is to use the Logger.log(Level level, Object message) method. The numbers used are for comparing Levels with each other, so your custom Level should have a number that places it, say, below DEBUG, or between INFO WARN. It's really up to you and what your Level is all about. To reference your custom level in the configuration file, you use the syntax that is at the very bottom of the example I sent: trace#my.package.TraceLevel e.g: log4j.rootLogger=trace#my.package.TraceLevel, MAIN, STDERR -Original Message- From: yacout dadoun [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 8:28 AM To: [EMAIL PROTECTED] Subject: RE: How to add new level Thanks, i 've already found this link but i dont know what values to give to TRACE_INT and SYSLOG_TRACE_INT they used 800 an d7 but in my case, i need this level, to be able to call logger.levelName(--); and in the log4j xml file send email to certain group each time levelName is called. From: Paul Smith [EMAIL PROTECTED] Reply-To: Log4J Users List [EMAIL PROTECTED] To: 'Log4J Users List' [EMAIL PROTECTED] Subject: RE: How to add new level Date: Wed, 28 Jul 2004 08:12:43 +1000 http://wiki.apache.org/logging-log4j/TraceLevel -Original Message- From: yacout dadoun [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 8:03 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: How to add new level Hi, How can i add new level to log4j? Thanks _ Share a single photo or an entire photo slide show right inside MSNR Messenger. http://join.msn.com/?pgmarket=en- capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market _ MSNIS_Taglines Start enjoying all the benefits of MSNR Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Take advantage of powerful junk e-mail filters built on patented MicrosoftR SmartScreen Technology. http://join.msn.com/?pgmarket=en- capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market_ MSNIS_Taglines Start enjoying all the benefits of MSNR Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Scan and help eliminate destructive viruses from your inbound and outbound e-mail and attachments. http://join.msn.com/?pgmarket=en-capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to add new level
If you read the constructor information in the example, the 9 is the Syslog equivalent level -Original Message- From: yacout dadoun [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 8:48 AM To: [EMAIL PROTECTED] Subject: RE: How to add new level Thanks, what about number 9 used in :LevelALL=new AlertLevel(ALL_INT,ALL,9) Thanks From: Paul Smith [EMAIL PROTECTED] Reply-To: Log4J Users List [EMAIL PROTECTED] To: 'Log4J Users List' [EMAIL PROTECTED] Subject: RE: How to add new level Date: Wed, 28 Jul 2004 08:36:57 +1000 You won't be able to call logger.levelName because unless you come up with your own LoggerFactory implementation, which is not recommended but possible. The usual way of using your custom level is to use the Logger.log(Level level, Object message) method. The numbers used are for comparing Levels with each other, so your custom Level should have a number that places it, say, below DEBUG, or between INFO WARN. It's really up to you and what your Level is all about. To reference your custom level in the configuration file, you use the syntax that is at the very bottom of the example I sent: trace#my.package.TraceLevel e.g: log4j.rootLogger=trace#my.package.TraceLevel, MAIN, STDERR -Original Message- From: yacout dadoun [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 8:28 AM To: [EMAIL PROTECTED] Subject: RE: How to add new level Thanks, i 've already found this link but i dont know what values to give to TRACE_INT and SYSLOG_TRACE_INT they used 800 an d7 but in my case, i need this level, to be able to call logger.levelName(--); and in the log4j xml file send email to certain group each time levelName is called. From: Paul Smith [EMAIL PROTECTED] Reply-To: Log4J Users List [EMAIL PROTECTED] To: 'Log4J Users List' [EMAIL PROTECTED] Subject: RE: How to add new level Date: Wed, 28 Jul 2004 08:12:43 +1000 http://wiki.apache.org/logging-log4j/TraceLevel -Original Message- From: yacout dadoun [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 8:03 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: How to add new level Hi, How can i add new level to log4j? Thanks _ Share a single photo or an entire photo slide show right inside MSNR Messenger. http://join.msn.com/?pgmarket=en- capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market _ MSNIS_Taglines Start enjoying all the benefits of MSNR Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: log4j-user- [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Take advantage of powerful junk e-mail filters built on patented MicrosoftR SmartScreen Technology. http://join.msn.com/?pgmarket=en- capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market _ MSNIS_Taglines Start enjoying all the benefits of MSNR Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Take charge with a pop-up guard built on patented MicrosoftR SmartScreen Technology http://join.msn.com/?pgmarket=en- capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market_ MSNIS_Taglines Start enjoying all the benefits of MSNR Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to add new level
In the XML file, whereever you could use the strings DEBUG/INFO/WARN/ERROR, just replace it with the string trace#my.package.TraceLevel. -Original Message- From: yacout dadoun [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 8:40 AM To: [EMAIL PROTECTED] Subject: RE: How to add new level Thanks for ur help To reference your custom level in the configuration file, you use the syntax that is at the very bottom of the example I sent: trace#my.package.TraceLevel e.g: log4j.rootLogger=trace#my.package.TraceLevel, MAIN, STDERR But how to add it to the xml log4j file not properties file ? From: Paul Smith [EMAIL PROTECTED] Reply-To: Log4J Users List [EMAIL PROTECTED] To: 'Log4J Users List' [EMAIL PROTECTED] Subject: RE: How to add new level Date: Wed, 28 Jul 2004 08:36:57 +1000 You won't be able to call logger.levelName because unless you come up with your own LoggerFactory implementation, which is not recommended but possible. The usual way of using your custom level is to use the Logger.log(Level level, Object message) method. The numbers used are for comparing Levels with each other, so your custom Level should have a number that places it, say, below DEBUG, or between INFO WARN. It's really up to you and what your Level is all about. To reference your custom level in the configuration file, you use the syntax that is at the very bottom of the example I sent: trace#my.package.TraceLevel e.g: log4j.rootLogger=trace#my.package.TraceLevel, MAIN, STDERR -Original Message- From: yacout dadoun [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 8:28 AM To: [EMAIL PROTECTED] Subject: RE: How to add new level Thanks, i 've already found this link but i dont know what values to give to TRACE_INT and SYSLOG_TRACE_INT they used 800 an d7 but in my case, i need this level, to be able to call logger.levelName(--); and in the log4j xml file send email to certain group each time levelName is called. From: Paul Smith [EMAIL PROTECTED] Reply-To: Log4J Users List [EMAIL PROTECTED] To: 'Log4J Users List' [EMAIL PROTECTED] Subject: RE: How to add new level Date: Wed, 28 Jul 2004 08:12:43 +1000 http://wiki.apache.org/logging-log4j/TraceLevel -Original Message- From: yacout dadoun [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 8:03 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: How to add new level Hi, How can i add new level to log4j? Thanks _ Share a single photo or an entire photo slide show right inside MSNR Messenger. http://join.msn.com/?pgmarket=en- capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market _ MSNIS_Taglines Start enjoying all the benefits of MSNR Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: log4j-user- [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Take advantage of powerful junk e-mail filters built on patented MicrosoftR SmartScreen Technology. http://join.msn.com/?pgmarket=en- capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market _ MSNIS_Taglines Start enjoying all the benefits of MSNR Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Scan and help eliminate destructive viruses from your inbound and outbound e-mail and attachments. http://join.msn.com/?pgmarket=en- capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market_ MSNIS_Taglines Start enjoying all the benefits of MSNR Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to add new level
I'm sure you can do this by either subclassing the Category or Logger class. My only question is why do you want another level other than DEBUG, INFO, WARNING, ERROR, or FATAL? What purpose do you have in mind? On Tue, 27 Jul 2004 22:02:32 +, yacout dadoun [EMAIL PROTECTED] wrote: Hi, How can i add new level to log4j? Thanks _ Share a single photo or an entire photo slide show right inside MSN® Messenger. http://join.msn.com/?pgmarket=en-capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Getting Log4j Properties to Hibernate
Hello, I hope someone here can give me a hint. I've been banging my head against a wall trying to get Hibernate tasks to see a log4j.properties or log4j.xml file for days. I'm using Ant (of course) for the build. I'm new to Hibernate, but have used Log4j before without difficulty. Hibernate's manual says you need only put log4j.jar and a properties file in the classpath, and everything will work. This has not been my experience. - The bit of Hibernate code I've focused on is hbm2java, which generates Java source from hbm.xml templates. Following James Elliott's nice intro book, the target is called codegen: target name=codegen depends=prepare-configs description=Generate Java code from hbm.xml files. taskdef name=hbm2java classname=net.sf.hibernate.tool.hbm2java.Hbm2JavaTask classpathref=classpath.project/ hbm2java output=${dir.src} classpath pathelement path=${classpath.project}/ /classpath fileset dir=${dir.src} include name=**/*.hbm.xml/ /fileset /hbm2java /target This *does* generate the file expected, but it complains: codegen: [hbm2java] Processing 1 files. [hbm2java] Building hibernate objects [hbm2java] log4j:WARN No appenders could be found for logger (net.sf.hibernate.util.DTDEntityResolver). [hbm2java] log4j:WARN Please initialize the log4j system properly. My attempts to get hbm2java to see a Log4j properties file: 1. Copied log4j.properties (from Hibernate's demo) throughout the build directory ('*' marks dirs with properties file): ap * --[build.xml is here] |-build * | |-classes * | |-org * ||-apnp * | |-nrd * |-lib * |-src * | |-config * | |-org * | |-apnp * ||-nrd * 2. Altered classpath.project to include many locations: path id=classpath.project pathelement location=${dir.src}/ pathelement location=${dir.build}/ pathelement location=${dir.build.classes}/ pathelement location=${dir.build.classes}/org/apnp/nrd/ fileset dir=${dir.src}/config include name=*.properties/ include name=*.dtd/ include name=*.xml/ /fileset fileset dir=${dir.lib} include name=*.jar/ include name=*.bat/ /fileset fileset dir=${tomcat.lib} include name=servlet-api.jar/ /fileset /path 3. Made hbm2java use this classpath both as source for taskdef and for running (as shown above): taskdef name=hbm2java classname=net.sf.hibernate.tool.hbm2java.Hbm2JavaTask classpathref=classpath.project/ hbm2java output=${dir.src} classpath pathelement path=${classpath.project}/ /classpath fileset dir=${dir.src} include name=**/*.hbm.xml/ /fileset /hbm2java 4. Had codegen display 'classpath.project' between hbm2java taskdef and running hbm2java: pathconvert targetos=windows property=classpathProject refid=classpath.project/ echoclasspathProject = ${classpathProject} /echo Which shows (adding line breaks): [echo] classpathProject = C:\1-AbundantPlanet\ap\src; C:\1-AbundantPlanet\ap\build; C:\1-AbundantPlanet\ap\build\classes; C:\1-AbundantPlanet\ap\src\config\hibernate-configuration-2.0.dtd; C:\1-AbundantPlanet\ap\src\config\hibernate-mapping-2.0.dtd; C:\1-AbundantPlanet\ap\src\config\hibernate.cfg.xml; C:\1-AbundantPlanet\ap\src\config\hibernate.properties; C:\1-AbundantPlanet\ap\src\config\log4j.dtd; C:\1-AbundantPlanet\ap\src\config\log4j.properties; C:\1-AbundantPlanet\ap\src\config\log4j.xml; C:\1-AbundantPlanet\ap\src\config\tomcat.properties; C:\1-AbundantPlanet\ap\src\config\tomcatTasks.properties; C:\1-AbundantPlanet\ap\lib\SchemaExport.bat; C:\1-AbundantPlanet\ap\lib\SchemaUpdate.bat; C:\1-AbundantPlanet\ap\lib\cglib-full-2.0.1.jar; C:\1-AbundantPlanet\ap\lib\class2hbm.bat; C:\1-AbundantPlanet\ap\lib\commons-collections-2.1.jar; C:\1-AbundantPlanet\ap\lib\commons-lang-1.0.1.jar; C:\1-AbundantPlanet\ap\lib\commons-logging-1.0.3.jar; C:\1-AbundantPlanet\ap\lib\ddl2hbm.bat; C:\1-AbundantPlanet\ap\lib\dom4j-1.4.jar; C:\1-AbundantPlanet\ap\lib\ehcache-0.7.jar; C:\1-AbundantPlanet\ap\lib\hbm2java.bat; C:\1-AbundantPlanet\ap\lib\hibernate-2.1.4.jar; C:\1-AbundantPlanet\ap\lib\hibernate-tools.jar; C:\1-AbundantPlanet\ap\lib\log4j-1.2.8.jar; C:\1-AbundantPlanet\ap\lib\mysql-connector-java-3.0.14.jar; C:\1-AbundantPlanet\ap\lib\odmg-3.0.jar; C:\Apache\Tomcat\Tomcat50\common\lib\servlet-api.jar The log4j.properties file from Hibernate's distribution, is simple ('warn' changed to 'debug'; comments and file appender deleted): log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout