RE: Help with RMI
Thanks gurus (Luis -n- Thomas ) That oughtaa get me started ;-). I'll try it out. Regards SimpleMortal - Original Message - From: Thomas Muller [EMAIL PROTECTED] Date: Wed, 16 Jul 2003 19:16:32 +0100 To: Log4J Users List [EMAIL PROTECTED] Subject: RE: Help with RMI Simple, There are several solutions to your problem. The simplest is to have one or several overloaded log methods defined in your remote interfaces, and your client can remote-log via these interfaces. A better solution might be to have an RMIAppender that communicates with a remote object which handles the LoggingEvents. I took the liberty to scratch a few lines to start you on the second approach. Please find attached file RemoteLogger.java, RemoteLoggerImpl.java and RMIAppender.java. Here is how you do it: 1. On the server side you need to register the RemoteLoggerImpl in the Registry, e.g. during application startup. 2. On the client side you can add the RMIAppender to any Logger you like (in the log4j.properties or log4j.xml file). The RMIAppender accept these parameters: host, port, remoteLoggerRegistryName. They all have sensible default values. 3. The server side log4j configuration file must pair sensible Loggers and Appenders. If you e.g. have a client side Logger named x.y.z, you add a Logger x.y.z and pair it with e.g. a FileAppender. Note: The code is totally untested, but it does compile without errors. It does by _no_ means hold up to production quality standards. Hope this helps, -- Thomas | -Original Message- | From: Simple Mortal [mailto:[EMAIL PROTECTED] | Sent: 16 July 2003 06:41 | To: [EMAIL PROTECTED] | Subject: Help with RMI | | | Hi gurus, | | Kudos for this excellent logging tool. | | I'm just stuck with a dilemma. I've used Log4j on standalone | applications before this and it work fine. But now I wanna use it | with a client-Server application ( RMI communication ). | | Confused regarding how I can configure log4j loggers on Client | and Server side.. The Client logger must be able to send crucial | failure logs over to the Server and maintain program execution | logs on Client side itself. The Server logger will be just | another basic logger. | | Please gimme some tips on how to set up the loggers for this one. | | Regards | SimpleMortal | | -- | __ | Sign-up for your own FREE Personalized E-mail at Mail.com | http://www.mail.com/?sr=signup | | CareerBuilder.com has over 400,000 jobs. Be smarter about your job search | http://corp.mail.com/careers | | | - | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | | * Copyright ERA Technology Ltd. 2003. (www.era.co.uk). All rights reserved. The information supplied in this Commercial Communication should be treated in confidence. No liability whatsoever is accepted for any loss or damage suffered as a result of accessing this message or any attachments. This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- __ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup CareerBuilder.com has over 400,000 jobs. Be smarter about your job search http://corp.mail.com/careers - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help debugging config file
Erik Price wrote: Hi, Can anyone see a problem with my log4j configuration? This exact same configuration works fine on another project, and if I change the appender to a ConsoleAppender then the output *does* get logged to stdout, but for some reason this configuration simply writes an empty log file named tests.log: Pardon me. With Inder's help I was able to deduce that the problem is that my unit tests were overwriting the file. I had forgotten that the append=false setting is ideal in [my] production environment, but in testing, it doesn't help very much for generating logs!! ;) Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help with Logging (1.2.7)
I had the same problem, I found out that jboss has its one log4j.properties file in the jar file jbossall-client.jar. (that's were the 09:20:47,919 INFO [STDOUT] is coming from). I solve it by placing the location of my log4j.properties in the CLASSPATH before the above jar file. Hope this will help. -Original Message- From: Corbin, James [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 6:20 PM To: Log4J Users List Subject: RE: Help with Logging (1.2.7) Thanks for the suggestion. I already have all loggers additivity set to false, but my logging to the category still is appended to a JBOSS INFO message before being displayed. I must be doing something fundamentally wrong. Does anyone have a clue? I've read all the threads about this from the archive. It has given me some insight, but hasn't addressed my issue. Can somebody explain why I see the following behavior: JBOSS logging setup to log to console and file. I define a new category in my application logging config file then attach new console and file appender to the category. My application then logs to the category. If I make the following call: myCategory.debug( sometext ); Why does this get appended to a [INFO] message before being displayed to the console. This is not an additivity issue as I only get one entry in the log. If someone could help me understand why I see log entries like the following with my setup I might be able to fix it. Where is the 09:20:47,919 INFO [STDOUT] coming from Everything after that is the data from my call to log to the category. 09:20:47,919 INFO [STDOUT] 09:20:47,919,MyCategory[INFO ] - setSuccessfulForward = /SendHouseList -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 7:13 AM To: Log4J Users List Subject: RE: Help with Logging (1.2.7) Howdy, Set additivity to false for all your loggers, or alternatively for the root logger. Yoav Shapira Millennium ChemInformatics -Original Message- From: Corbin, James [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 6:30 PM To: Log4J Users List Subject: RE: Help with Logging (1.2.7) That would work, but I forgot to mention that our application is deployed on multiple server vendors and not just JBOSS. If it were, I would definitely not need to have a application specific configuration file. J.D. -Original Message- From: Rafal Kedziorski [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 4:08 PM To: Log4J Users List Subject: Re: Help with Logging (1.2.7) hi, why don't You use the log4j included to JBoss? I'm working with this and it works fine. Rafal At 16:39 03.03.2003 -0500, Corbin, James wrote: I am using Log4j version 1.2.7 as my application logging framework running on a JBOSS app server. The only issue I have run into is trying to define a separate configuration file that when loaded doesn't interfere with the one loaded at server startup by JBOSS. Therefore, I created the following configuration file which creates a category and my application logs to the category. This works as I've mentioned in previous emails, but the console log appends my messages to an INFO message (from JBOSS configuration?). I've included a log entry to demonstrate my issue: 14:36:14,648 INFO [STDOUT] 14:36:14,648,LightSpeed[DEBUG] - some message text My category name is LightSpeed. Notice how the [DEBUG] message is appended to a INFO [STDOUT] message? I assume this is coming from the JBOSS configuration of Log4j. Application Specific Configuration File * ## The server.log file appender for LightSpeed log4j.category.LightSpeed=DEBUG, LightSpeed_Console, LightSpeed_Default log4j.additivity.LightSpeed=false; log4j.appender.LightSpeed_Default=org.apache.log4j.RollingFileAppender log4j.appender.LightSpeed_Default.File=server.log log4j.appender.LightSpeed_Default.MaxFileSize=500KB log4j.appender.LightSpeed_Default.MaxBackupIndex=1 log4j.appender.LightSpeed_Default.layout=org.apache.log4j.PatternLayou t #log4j.appender.LightSpeed_Default.layout.ConversionPattern=%d %-5p [%t] %-17c{2} (%13F:%L) %3x - %m\n #log4j.appender.LightSpeed_Default.layout.ConversionPattern=[%d{ABSOLU TE}, % c {1}] %m%n log4j.appender.LightSpeed_Default.layout.ConversionPattern=%d{ABSOLUTE },%- 1 7 c [%-5p] - %m%n log4j.appender.LightSpeed_Console=org.apache.log4j.ConsoleAppender log4j.appender.LightSpeed_Console.layout=org.apache.log4j.PatternLayou t log4j.appender.LightSpeed_Console.layout.ConversionPattern=%d{ABSOLUTE },%- 1 7 c [%-5p] - %m%n _ J.D. Corbin Architecture and Emerging Systems Starwood Technology and Revenue Systems 9285 Teddy Lane, Suite 230 Lone Tree, CO 80124 Phone: 303.790.9551 Fax:303.790.9550 [EMAIL PROTECTED] _ This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information is intended only
RE: Help with Logging (1.2.7)
Howdy, Set additivity to false for all your loggers, or alternatively for the root logger. Yoav Shapira Millennium ChemInformatics -Original Message- From: Corbin, James [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 6:30 PM To: Log4J Users List Subject: RE: Help with Logging (1.2.7) That would work, but I forgot to mention that our application is deployed on multiple server vendors and not just JBOSS. If it were, I would definitely not need to have a application specific configuration file. J.D. -Original Message- From: Rafal Kedziorski [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 4:08 PM To: Log4J Users List Subject: Re: Help with Logging (1.2.7) hi, why don't You use the log4j included to JBoss? I'm working with this and it works fine. Rafal At 16:39 03.03.2003 -0500, Corbin, James wrote: I am using Log4j version 1.2.7 as my application logging framework running on a JBOSS app server. The only issue I have run into is trying to define a separate configuration file that when loaded doesn't interfere with the one loaded at server startup by JBOSS. Therefore, I created the following configuration file which creates a category and my application logs to the category. This works as I've mentioned in previous emails, but the console log appends my messages to an INFO message (from JBOSS configuration?). I've included a log entry to demonstrate my issue: 14:36:14,648 INFO [STDOUT] 14:36:14,648,LightSpeed[DEBUG] - some message text My category name is LightSpeed. Notice how the [DEBUG] message is appended to a INFO [STDOUT] message? I assume this is coming from the JBOSS configuration of Log4j. Application Specific Configuration File * ## The server.log file appender for LightSpeed log4j.category.LightSpeed=DEBUG, LightSpeed_Console, LightSpeed_Default log4j.additivity.LightSpeed=false; log4j.appender.LightSpeed_Default=org.apache.log4j.RollingFileAppender log4j.appender.LightSpeed_Default.File=server.log log4j.appender.LightSpeed_Default.MaxFileSize=500KB log4j.appender.LightSpeed_Default.MaxBackupIndex=1 log4j.appender.LightSpeed_Default.layout=org.apache.log4j.PatternLayou t #log4j.appender.LightSpeed_Default.layout.ConversionPattern=%d %-5p [%t] %-17c{2} (%13F:%L) %3x - %m\n #log4j.appender.LightSpeed_Default.layout.ConversionPattern=[%d{ABSOLU TE}, % c {1}] %m%n log4j.appender.LightSpeed_Default.layout.ConversionPattern=%d{ABSOLUTE },%- 1 7 c [%-5p] - %m%n log4j.appender.LightSpeed_Console=org.apache.log4j.ConsoleAppender log4j.appender.LightSpeed_Console.layout=org.apache.log4j.PatternLayou t log4j.appender.LightSpeed_Console.layout.ConversionPattern=%d{ABSOLUTE },%- 1 7 c [%-5p] - %m%n _ J.D. Corbin Architecture and Emerging Systems Starwood Technology and Revenue Systems 9285 Teddy Lane, Suite 230 Lone Tree, CO 80124 Phone: 303.790.9551 Fax:303.790.9550 [EMAIL PROTECTED] _ This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information is intended only for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying or distribution or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender immediately by replying to the address listed in the From: field. - 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] This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information is intended only for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying or distribution or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender immediately by replying to the address listed in the From: field. - 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
RE: Help with Logging (1.2.7)
Thanks for the suggestion. I already have all loggers additivity set to false, but my logging to the category still is appended to a JBOSS INFO message before being displayed. I must be doing something fundamentally wrong. Does anyone have a clue? I've read all the threads about this from the archive. It has given me some insight, but hasn't addressed my issue. Can somebody explain why I see the following behavior: JBOSS logging setup to log to console and file. I define a new category in my application logging config file then attach new console and file appender to the category. My application then logs to the category. If I make the following call: myCategory.debug( sometext ); Why does this get appended to a [INFO] message before being displayed to the console. This is not an additivity issue as I only get one entry in the log. If someone could help me understand why I see log entries like the following with my setup I might be able to fix it. Where is the 09:20:47,919 INFO [STDOUT] coming from Everything after that is the data from my call to log to the category. 09:20:47,919 INFO [STDOUT] 09:20:47,919,MyCategory[INFO ] - setSuccessfulForward = /SendHouseList -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 7:13 AM To: Log4J Users List Subject: RE: Help with Logging (1.2.7) Howdy, Set additivity to false for all your loggers, or alternatively for the root logger. Yoav Shapira Millennium ChemInformatics -Original Message- From: Corbin, James [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 6:30 PM To: Log4J Users List Subject: RE: Help with Logging (1.2.7) That would work, but I forgot to mention that our application is deployed on multiple server vendors and not just JBOSS. If it were, I would definitely not need to have a application specific configuration file. J.D. -Original Message- From: Rafal Kedziorski [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 4:08 PM To: Log4J Users List Subject: Re: Help with Logging (1.2.7) hi, why don't You use the log4j included to JBoss? I'm working with this and it works fine. Rafal At 16:39 03.03.2003 -0500, Corbin, James wrote: I am using Log4j version 1.2.7 as my application logging framework running on a JBOSS app server. The only issue I have run into is trying to define a separate configuration file that when loaded doesn't interfere with the one loaded at server startup by JBOSS. Therefore, I created the following configuration file which creates a category and my application logs to the category. This works as I've mentioned in previous emails, but the console log appends my messages to an INFO message (from JBOSS configuration?). I've included a log entry to demonstrate my issue: 14:36:14,648 INFO [STDOUT] 14:36:14,648,LightSpeed[DEBUG] - some message text My category name is LightSpeed. Notice how the [DEBUG] message is appended to a INFO [STDOUT] message? I assume this is coming from the JBOSS configuration of Log4j. Application Specific Configuration File * ## The server.log file appender for LightSpeed log4j.category.LightSpeed=DEBUG, LightSpeed_Console, LightSpeed_Default log4j.additivity.LightSpeed=false; log4j.appender.LightSpeed_Default=org.apache.log4j.RollingFileAppender log4j.appender.LightSpeed_Default.File=server.log log4j.appender.LightSpeed_Default.MaxFileSize=500KB log4j.appender.LightSpeed_Default.MaxBackupIndex=1 log4j.appender.LightSpeed_Default.layout=org.apache.log4j.PatternLayou t #log4j.appender.LightSpeed_Default.layout.ConversionPattern=%d %-5p [%t] %-17c{2} (%13F:%L) %3x - %m\n #log4j.appender.LightSpeed_Default.layout.ConversionPattern=[%d{ABSOLU TE}, % c {1}] %m%n log4j.appender.LightSpeed_Default.layout.ConversionPattern=%d{ABSOLUTE },%- 1 7 c [%-5p] - %m%n log4j.appender.LightSpeed_Console=org.apache.log4j.ConsoleAppender log4j.appender.LightSpeed_Console.layout=org.apache.log4j.PatternLayou t log4j.appender.LightSpeed_Console.layout.ConversionPattern=%d{ABSOLUTE },%- 1 7 c [%-5p] - %m%n _ J.D. Corbin Architecture and Emerging Systems Starwood Technology and Revenue Systems 9285 Teddy Lane, Suite 230 Lone Tree, CO 80124 Phone: 303.790.9551 Fax:303.790.9550 [EMAIL PROTECTED] _ This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information is intended only for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying or distribution or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender immediately by replying to the address listed in the From: field. - To unsubscribe, e-mail: [EMAIL PROTECTED
RE: Help with Logging (1.2.7)
Just to make sure I understand: The statement is completely correct when going to LightSpeed_Default appender; but then everything going to the LightSpeed_Console appender displays the characteristics you mention? Is it every message that you log to the console appender? If so, my guess is that JBOSS is catching System.out/System.err and handling those itself. Never dealt with JBOSS. Have you asked this question on their mailing list? |-Original Message- |From: Corbin, James [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 04, 2003 10:20 AM |To: Log4J Users List |Subject: RE: Help with Logging (1.2.7) | | | |Thanks for the suggestion. I already have all loggers |additivity set to |false, but my logging to the category still is appended to |a JBOSS INFO |message before being displayed. | |I must be doing something fundamentally wrong. Does |anyone have a clue? | |I've read all the threads about this from the archive. It |has given me some |insight, but hasn't addressed my issue. | |Can somebody explain why I see the following behavior: | |JBOSS logging setup to log to console and file. I define |a new category in |my application logging config file then attach new console |and file appender |to the category. My application then logs to the |category. If I make the |following call: myCategory.debug( sometext ); | |Why does this get appended to a [INFO] message before |being displayed to the |console. This is not an additivity issue as I only get |one entry in the |log. | |If someone could help me understand why I see log entries |like the following |with my setup I might be able to fix it. Where is the |09:20:47,919 INFO |[STDOUT] coming from Everything after that is the |data from my call to |log to the category. | |09:20:47,919 INFO [STDOUT] 09:20:47,919,MyCategory |[INFO ] - | setSuccessfulForward = /SendHouseList | | |-Original Message- |From: Shapira, Yoav [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 04, 2003 7:13 AM |To: Log4J Users List |Subject: RE: Help with Logging (1.2.7) | | |Howdy, |Set additivity to false for all your loggers, or |alternatively for the |root logger. | |Yoav Shapira |Millennium ChemInformatics | | |-Original Message- |From: Corbin, James [mailto:[EMAIL PROTECTED] |Sent: Monday, March 03, 2003 6:30 PM |To: Log4J Users List |Subject: RE: Help with Logging (1.2.7) | | |That would work, but I forgot to mention that our application is |deployed |on |multiple server vendors and not just JBOSS. If it were, I would |definitely |not need to have a application specific configuration file. | |J.D. | |-Original Message- |From: Rafal Kedziorski [mailto:[EMAIL PROTECTED] |Sent: Monday, March 03, 2003 4:08 PM |To: Log4J Users List |Subject: Re: Help with Logging (1.2.7) | |hi, | |why don't You use the log4j included to JBoss? I'm |working with this |and it |works fine. | | |Rafal | |At 16:39 03.03.2003 -0500, Corbin, James wrote: | |I am using Log4j version 1.2.7 as my application logging |framework |running |on a JBOSS app server. | |The only issue I have run into is trying to define a separate |configuration |file that when loaded doesn't interfere with the one |loaded at server |startup by JBOSS. Therefore, I created the following |configuration |file |which creates a category and my application logs to the category. |This |works as I've mentioned in previous emails, but the console log |appends my |messages to an INFO message (from JBOSS configuration?). I've |included a |log entry to demonstrate my issue: | |14:36:14,648 INFO [STDOUT] 14:36:14,648,LightSpeed | [DEBUG] - |some |message text | |My category name is LightSpeed. Notice how the [DEBUG] |message is |appended |to a INFO [STDOUT] message? I assume this is coming |from the JBOSS |configuration of Log4j. | |Application Specific Configuration File * | |## The server.log file appender for LightSpeed |log4j.category.LightSpeed=DEBUG, LightSpeed_Console, |LightSpeed_Default |log4j.additivity.LightSpeed=false; |log4j.appender.LightSpeed_Default=org.apache.log4j.Rollin |gFileAppender |log4j.appender.LightSpeed_Default.File=server.log |log4j.appender.LightSpeed_Default.MaxFileSize=500KB |log4j.appender.LightSpeed_Default.MaxBackupIndex=1 |log4j.appender.LightSpeed_Default.layout=org.apache.log4j |.PatternLayou |t
RE: Help with Logging (1.2.7)
Actually, this should be really easy to test, now that I thought about it further. What happens if you add a System.out.println() call? Does it show up with the same INFO marking? |-Original Message- |From: Ebersole, Steven [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 04, 2003 10:50 AM |To: 'Log4J Users List' |Subject: RE: Help with Logging (1.2.7) | | |Just to make sure I understand: | |The statement is completely correct when going to |LightSpeed_Default |appender; but then everything going to the |LightSpeed_Console appender |displays the characteristics you mention? Is it every |message that you log |to the console appender? | |If so, my guess is that JBOSS is catching |System.out/System.err and handling |those itself. Never dealt with JBOSS. Have you asked |this question on |their mailing list? | | | | ||-Original Message- ||From: Corbin, James [mailto:[EMAIL PROTECTED] ||Sent: Tuesday, March 04, 2003 10:20 AM ||To: Log4J Users List ||Subject: RE: Help with Logging (1.2.7) || || || ||Thanks for the suggestion. I already have all loggers ||additivity set to ||false, but my logging to the category still is appended to ||a JBOSS INFO ||message before being displayed. || ||I must be doing something fundamentally wrong. Does ||anyone have a clue? || ||I've read all the threads about this from the archive. It ||has given me some ||insight, but hasn't addressed my issue. || ||Can somebody explain why I see the following behavior: || ||JBOSS logging setup to log to console and file. I define ||a new category in ||my application logging config file then attach new console ||and file appender ||to the category. My application then logs to the ||category. If I make the ||following call: myCategory.debug( sometext ); || ||Why does this get appended to a [INFO] message before ||being displayed to the ||console. This is not an additivity issue as I only get ||one entry in the ||log. || ||If someone could help me understand why I see log entries ||like the following ||with my setup I might be able to fix it. Where is the ||09:20:47,919 INFO ||[STDOUT] coming from Everything after that is the ||data from my call to ||log to the category. || ||09:20:47,919 INFO [STDOUT] 09:20:47,919,MyCategory ||[INFO ] - || setSuccessfulForward = /SendHouseList || || ||-Original Message- ||From: Shapira, Yoav [mailto:[EMAIL PROTECTED] ||Sent: Tuesday, March 04, 2003 7:13 AM ||To: Log4J Users List ||Subject: RE: Help with Logging (1.2.7) || || ||Howdy, ||Set additivity to false for all your loggers, or ||alternatively for the ||root logger. || ||Yoav Shapira ||Millennium ChemInformatics || || ||-Original Message- ||From: Corbin, James [mailto:[EMAIL PROTECTED] ||Sent: Monday, March 03, 2003 6:30 PM ||To: Log4J Users List ||Subject: RE: Help with Logging (1.2.7) || || ||That would work, but I forgot to mention that our |application is ||deployed ||on ||multiple server vendors and not just JBOSS. If it |were, I would ||definitely ||not need to have a application specific configuration file. || ||J.D. || ||-Original Message- ||From: Rafal Kedziorski [mailto:[EMAIL PROTECTED] ||Sent: Monday, March 03, 2003 4:08 PM ||To: Log4J Users List ||Subject: Re: Help with Logging (1.2.7) || ||hi, || ||why don't You use the log4j included to JBoss? I'm ||working with this ||and it ||works fine. || || ||Rafal || ||At 16:39 03.03.2003 -0500, Corbin, James wrote: || ||I am using Log4j version 1.2.7 as my application logging ||framework ||running ||on a JBOSS app server. || ||The only issue I have run into is trying to define |a separate ||configuration ||file that when loaded doesn't interfere with the one ||loaded at server ||startup by JBOSS. Therefore, I created the following ||configuration ||file ||which creates a category and my application logs to |the category. ||This ||works as I've mentioned in previous emails
RE: Help with Logging (1.2.7)
The logs look identical, both the console and log file. It is happening in both places. -Original Message- From: Ebersole, Steven [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 9:50 AM To: 'Log4J Users List' Subject: RE: Help with Logging (1.2.7) Just to make sure I understand: The statement is completely correct when going to LightSpeed_Default appender; but then everything going to the LightSpeed_Console appender displays the characteristics you mention? Is it every message that you log to the console appender? If so, my guess is that JBOSS is catching System.out/System.err and handling those itself. Never dealt with JBOSS. Have you asked this question on their mailing list? |-Original Message- |From: Corbin, James [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 04, 2003 10:20 AM |To: Log4J Users List |Subject: RE: Help with Logging (1.2.7) | | | |Thanks for the suggestion. I already have all loggers |additivity set to |false, but my logging to the category still is appended to |a JBOSS INFO |message before being displayed. | |I must be doing something fundamentally wrong. Does |anyone have a clue? | |I've read all the threads about this from the archive. It |has given me some |insight, but hasn't addressed my issue. | |Can somebody explain why I see the following behavior: | |JBOSS logging setup to log to console and file. I define |a new category in |my application logging config file then attach new console |and file appender |to the category. My application then logs to the |category. If I make the |following call: myCategory.debug( sometext ); | |Why does this get appended to a [INFO] message before |being displayed to the |console. This is not an additivity issue as I only get |one entry in the |log. | |If someone could help me understand why I see log entries |like the following |with my setup I might be able to fix it. Where is the |09:20:47,919 INFO |[STDOUT] coming from Everything after that is the |data from my call to |log to the category. | |09:20:47,919 INFO [STDOUT] 09:20:47,919,MyCategory |[INFO ] - | setSuccessfulForward = /SendHouseList | | |-Original Message- |From: Shapira, Yoav [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 04, 2003 7:13 AM |To: Log4J Users List |Subject: RE: Help with Logging (1.2.7) | | |Howdy, |Set additivity to false for all your loggers, or |alternatively for the |root logger. | |Yoav Shapira |Millennium ChemInformatics | | |-Original Message- |From: Corbin, James [mailto:[EMAIL PROTECTED] |Sent: Monday, March 03, 2003 6:30 PM |To: Log4J Users List |Subject: RE: Help with Logging (1.2.7) | | |That would work, but I forgot to mention that our application is |deployed |on |multiple server vendors and not just JBOSS. If it were, I would |definitely |not need to have a application specific configuration file. | |J.D. | |-Original Message- |From: Rafal Kedziorski [mailto:[EMAIL PROTECTED] |Sent: Monday, March 03, 2003 4:08 PM |To: Log4J Users List |Subject: Re: Help with Logging (1.2.7) | |hi, | |why don't You use the log4j included to JBoss? I'm |working with this |and it |works fine. | | |Rafal | |At 16:39 03.03.2003 -0500, Corbin, James wrote: | |I am using Log4j version 1.2.7 as my application logging |framework |running |on a JBOSS app server. | |The only issue I have run into is trying to define a separate |configuration |file that when loaded doesn't interfere with the one |loaded at server |startup by JBOSS. Therefore, I created the following |configuration |file |which creates a category and my application logs to the category. |This |works as I've mentioned in previous emails, but the console log |appends my |messages to an INFO message (from JBOSS configuration?). I've |included a |log entry to demonstrate my issue: | |14:36:14,648 INFO [STDOUT] 14:36:14,648,LightSpeed | [DEBUG] - |some |message text | |My category name is LightSpeed. Notice how the [DEBUG] |message is |appended |to a INFO [STDOUT] message? I assume this is coming |from the JBOSS |configuration of Log4j. | |Application Specific Configuration File * | |## The server.log file appender for LightSpeed |log4j.category.LightSpeed=DEBUG, LightSpeed_Console, |LightSpeed_Default |log4j.additivity.LightSpeed=false; |log4j.appender.LightSpeed_Default=org.apache.log4j.Rollin |gFileAppender
RE: Help with Logging (1.2.7)
A System.out.println() logs as I would expect. Below is a System.out.println(), taken from the JBOSS console output. 09:59:16,398 INFO [STDOUT] Key = OTA_HotelResSearchRQ J.D. -Original Message- From: Ebersole, Steven [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 9:57 AM To: 'Log4J Users List' Subject: RE: Help with Logging (1.2.7) Actually, this should be really easy to test, now that I thought about it further. What happens if you add a System.out.println() call? Does it show up with the same INFO marking? |-Original Message- |From: Ebersole, Steven [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 04, 2003 10:50 AM |To: 'Log4J Users List' |Subject: RE: Help with Logging (1.2.7) | | |Just to make sure I understand: | |The statement is completely correct when going to |LightSpeed_Default |appender; but then everything going to the |LightSpeed_Console appender |displays the characteristics you mention? Is it every |message that you log |to the console appender? | |If so, my guess is that JBOSS is catching |System.out/System.err and handling |those itself. Never dealt with JBOSS. Have you asked |this question on |their mailing list? | | | | ||-Original Message- ||From: Corbin, James [mailto:[EMAIL PROTECTED] ||Sent: Tuesday, March 04, 2003 10:20 AM ||To: Log4J Users List ||Subject: RE: Help with Logging (1.2.7) || || || ||Thanks for the suggestion. I already have all loggers ||additivity set to ||false, but my logging to the category still is appended to ||a JBOSS INFO ||message before being displayed. || ||I must be doing something fundamentally wrong. Does ||anyone have a clue? || ||I've read all the threads about this from the archive. It ||has given me some ||insight, but hasn't addressed my issue. || ||Can somebody explain why I see the following behavior: || ||JBOSS logging setup to log to console and file. I define ||a new category in ||my application logging config file then attach new console ||and file appender ||to the category. My application then logs to the ||category. If I make the ||following call: myCategory.debug( sometext ); || ||Why does this get appended to a [INFO] message before ||being displayed to the ||console. This is not an additivity issue as I only get ||one entry in the ||log. || ||If someone could help me understand why I see log entries ||like the following ||with my setup I might be able to fix it. Where is the ||09:20:47,919 INFO ||[STDOUT] coming from Everything after that is the ||data from my call to ||log to the category. || ||09:20:47,919 INFO [STDOUT] 09:20:47,919,MyCategory ||[INFO ] - || setSuccessfulForward = /SendHouseList || || ||-Original Message- ||From: Shapira, Yoav [mailto:[EMAIL PROTECTED] ||Sent: Tuesday, March 04, 2003 7:13 AM ||To: Log4J Users List ||Subject: RE: Help with Logging (1.2.7) || || ||Howdy, ||Set additivity to false for all your loggers, or ||alternatively for the ||root logger. || ||Yoav Shapira ||Millennium ChemInformatics || || ||-Original Message- ||From: Corbin, James [mailto:[EMAIL PROTECTED] ||Sent: Monday, March 03, 2003 6:30 PM ||To: Log4J Users List ||Subject: RE: Help with Logging (1.2.7) || || ||That would work, but I forgot to mention that our |application is ||deployed ||on ||multiple server vendors and not just JBOSS. If it |were, I would ||definitely ||not need to have a application specific configuration file. || ||J.D. || ||-Original Message- ||From: Rafal Kedziorski [mailto:[EMAIL PROTECTED] ||Sent: Monday, March 03, 2003 4:08 PM ||To: Log4J Users List ||Subject: Re: Help with Logging (1.2.7) || ||hi, || ||why don't You use the log4j included to JBoss? I'm ||working with this ||and it ||works fine. || || ||Rafal || ||At 16:39 03.03.2003 -0500, Corbin, James wrote: || ||I am using Log4j version 1.2.7 as my application logging ||framework ||running ||on a JBOSS app server. || ||The only issue I have run into is trying to define |a separate
RE: Help with Logging (1.2.7)
But what String did you pass to the println method to get that output? If you just simply did 'System.out.println( Key = OTA_HotelResSearchRQ );', then the result is NOT normal stdout behaviour, and would seem JBOSS is defintely manually redirecting stdout (plus adding the additional info). The logs look identical, both the console and log file. It is happening in both places. OK, so say you call the logging method: log.debug( Key = OTA_HotelResSearchRQ ); Then the console shows: 14:36:14,648 INFO [STDOUT] 14:36:14,648,LightSpeed[DEBUG] - Key = OTA_HotelResSearchRQ _AND_ The file server.log has the line: 14:36:14,648 INFO [STDOUT] 14:36:14,648,LightSpeed[DEBUG] - Key = OTA_HotelResSearchRQ ??? That just doesn't make any sense. |-Original Message- |From: Corbin, James [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 04, 2003 10:57 AM |To: Log4J Users List |Subject: RE: Help with Logging (1.2.7) | | | |A System.out.println() logs as I would expect. Below is a |System.out.println(), taken from the JBOSS console output. | |09:59:16,398 INFO [STDOUT] Key = OTA_HotelResSearchRQ | |J.D. | |-Original Message- |From: Ebersole, Steven [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 04, 2003 9:57 AM |To: 'Log4J Users List' |Subject: RE: Help with Logging (1.2.7) | |Actually, this should be really easy to test, now that I |thought about it |further. What happens if you add a System.out.println() |call? Does it show |up with the same INFO marking? | | ||-Original Message- ||From: Ebersole, Steven [mailto:[EMAIL PROTECTED] ||Sent: Tuesday, March 04, 2003 10:50 AM ||To: 'Log4J Users List' ||Subject: RE: Help with Logging (1.2.7) || || ||Just to make sure I understand: || ||The statement is completely correct when going to ||LightSpeed_Default ||appender; but then everything going to the ||LightSpeed_Console appender ||displays the characteristics you mention? Is it every ||message that you log ||to the console appender? || ||If so, my guess is that JBOSS is catching ||System.out/System.err and handling ||those itself. Never dealt with JBOSS. Have you asked ||this question on ||their mailing list? || || || || |||-Original Message- |||From: Corbin, James |[mailto:[EMAIL PROTECTED] |||Sent: Tuesday, March 04, 2003 10:20 AM |||To: Log4J Users List |||Subject: RE: Help with Logging (1.2.7) ||| ||| ||| |||Thanks for the suggestion. I already have all loggers |||additivity set to |||false, but my logging to the category still is |appended to |||a JBOSS INFO |||message before being displayed. ||| |||I must be doing something fundamentally wrong. Does |||anyone have a clue? ||| |||I've read all the threads about this from the |archive. It |||has given me some |||insight, but hasn't addressed my issue. ||| |||Can somebody explain why I see the following behavior: ||| |||JBOSS logging setup to log to console and file. |I define |||a new category in |||my application logging config file then attach |new console |||and file appender |||to the category. My application then logs to the |||category. If I make the |||following call: myCategory.debug( sometext ); ||| |||Why does this get appended to a [INFO] message before |||being displayed to the |||console. This is not an additivity issue as I only get |||one entry in the |||log. ||| |||If someone could help me understand why I see |log entries |||like the following |||with my setup I might be able to fix it. Where is the |||09:20:47,919 INFO |||[STDOUT] coming from Everything after that is the |||data from my call to |||log to the category. ||| |||09:20:47,919 INFO [STDOUT] |09:20:47,919,MyCategory |||[INFO ] - ||| setSuccessfulForward = /SendHouseList ||| ||| |||-Original Message- |||From: Shapira, Yoav [mailto:[EMAIL PROTECTED] |||Sent: Tuesday, March 04, 2003 7:13 AM |||To: Log4J Users List |||Subject: RE: Help with Logging (1.2.7
RE: Help with Logging (1.2.7)
You are correct. I still would like to be able to define, through my application specific configuration file, a console and rolling file appender that doesn't conflict with the console and rolling file appender defined by the JBOSS installation. I need this because we deploy on multiple platforms of which I cannot guarantee they will be using log4J for their application server logging. -Original Message- From: Ebersole, Steven [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 10:20 AM To: 'Log4J Users List' Subject: RE: Help with Logging (1.2.7) But what String did you pass to the println method to get that output? If you just simply did 'System.out.println( Key = OTA_HotelResSearchRQ );', then the result is NOT normal stdout behaviour, and would seem JBOSS is defintely manually redirecting stdout (plus adding the additional info). The logs look identical, both the console and log file. It is happening in both places. OK, so say you call the logging method: log.debug( Key = OTA_HotelResSearchRQ ); Then the console shows: 14:36:14,648 INFO [STDOUT] 14:36:14,648,LightSpeed[DEBUG] - Key = OTA_HotelResSearchRQ _AND_ The file server.log has the line: 14:36:14,648 INFO [STDOUT] 14:36:14,648,LightSpeed[DEBUG] - Key = OTA_HotelResSearchRQ ??? That just doesn't make any sense. |-Original Message- |From: Corbin, James [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 04, 2003 10:57 AM |To: Log4J Users List |Subject: RE: Help with Logging (1.2.7) | | | |A System.out.println() logs as I would expect. Below is a |System.out.println(), taken from the JBOSS console output. | |09:59:16,398 INFO [STDOUT] Key = OTA_HotelResSearchRQ | |J.D. | |-Original Message- |From: Ebersole, Steven [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 04, 2003 9:57 AM |To: 'Log4J Users List' |Subject: RE: Help with Logging (1.2.7) | |Actually, this should be really easy to test, now that I |thought about it |further. What happens if you add a System.out.println() |call? Does it show |up with the same INFO marking? | | ||-Original Message- ||From: Ebersole, Steven [mailto:[EMAIL PROTECTED] ||Sent: Tuesday, March 04, 2003 10:50 AM ||To: 'Log4J Users List' ||Subject: RE: Help with Logging (1.2.7) || || ||Just to make sure I understand: || ||The statement is completely correct when going to ||LightSpeed_Default ||appender; but then everything going to the ||LightSpeed_Console appender ||displays the characteristics you mention? Is it every ||message that you log ||to the console appender? || ||If so, my guess is that JBOSS is catching ||System.out/System.err and handling ||those itself. Never dealt with JBOSS. Have you asked ||this question on ||their mailing list? || || || || |||-Original Message- |||From: Corbin, James |[mailto:[EMAIL PROTECTED] |||Sent: Tuesday, March 04, 2003 10:20 AM |||To: Log4J Users List |||Subject: RE: Help with Logging (1.2.7) ||| ||| ||| |||Thanks for the suggestion. I already have all loggers |||additivity set to |||false, but my logging to the category still is |appended to |||a JBOSS INFO |||message before being displayed. ||| |||I must be doing something fundamentally wrong. Does |||anyone have a clue? ||| |||I've read all the threads about this from the |archive. It |||has given me some |||insight, but hasn't addressed my issue. ||| |||Can somebody explain why I see the following behavior: ||| |||JBOSS logging setup to log to console and file. |I define |||a new category in |||my application logging config file then attach |new console |||and file appender |||to the category. My application then logs to the |||category. If I make the |||following call: myCategory.debug( sometext ); ||| |||Why does this get appended to a [INFO] message before |||being displayed to the |||console. This is not an additivity issue as I only get |||one entry in the |||log. ||| |||If someone could help me understand why I see |log entries |||like the following |||with my setup I might be able to fix it. Where is the |||09:20:47,919 INFO |||[STDOUT] coming from Everything after
RE: Help with Logging (1.2.7)
Sorry, cannot help you there. As I mentioned I have zero experience using JBOSS. For the console one, I would suggest that it really isn't that big of a deal (but thats just me). For the file appender, however, I cannot begin to fathom how they could be catching those. Might want to ask these on the JBOSS mailing list to see if any over there have come to terms with this. At any rate, it definitely seems a JBOSS issue. |-Original Message- |From: Corbin, James [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 04, 2003 11:36 AM |To: Log4J Users List |Subject: RE: Help with Logging (1.2.7) | | | |You are correct. | |I still would like to be able to define, through my |application specific |configuration file, a console and rolling file appender |that doesn't |conflict with the console and rolling file appender |defined by the JBOSS |installation. I need this because we deploy on multiple |platforms of which |I cannot guarantee they will be using log4J for their |application server |logging. | | |-Original Message- |From: Ebersole, Steven [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 04, 2003 10:20 AM |To: 'Log4J Users List' |Subject: RE: Help with Logging (1.2.7) | |But what String did you pass to the println method to get |that output? If |you just simply did 'System.out.println( Key = |OTA_HotelResSearchRQ );', |then the result is NOT normal stdout behaviour, and would |seem JBOSS is |defintely manually redirecting stdout (plus adding the |additional info). | | | The logs look identical, both the console and log file. | It is happening |in |both places. | |OK, so say you call the logging method: |log.debug( Key = OTA_HotelResSearchRQ ); | |Then the console shows: |14:36:14,648 INFO [STDOUT] 14:36:14,648,LightSpeed |[DEBUG] - Key = |OTA_HotelResSearchRQ | |_AND_ |The file server.log has the line: |14:36:14,648 INFO [STDOUT] 14:36:14,648,LightSpeed |[DEBUG] - Key = |OTA_HotelResSearchRQ | |??? | |That just doesn't make any sense. | | | | | ||-Original Message- ||From: Corbin, James [mailto:[EMAIL PROTECTED] ||Sent: Tuesday, March 04, 2003 10:57 AM ||To: Log4J Users List ||Subject: RE: Help with Logging (1.2.7) || || || ||A System.out.println() logs as I would expect. Below is a ||System.out.println(), taken from the JBOSS console output. || ||09:59:16,398 INFO [STDOUT] Key = OTA_HotelResSearchRQ || ||J.D. || ||-Original Message- ||From: Ebersole, Steven [mailto:[EMAIL PROTECTED] ||Sent: Tuesday, March 04, 2003 9:57 AM ||To: 'Log4J Users List' ||Subject: RE: Help with Logging (1.2.7) || ||Actually, this should be really easy to test, now that I ||thought about it ||further. What happens if you add a System.out.println() ||call? Does it show ||up with the same INFO marking? || || |||-Original Message- |||From: Ebersole, Steven |[mailto:[EMAIL PROTECTED] |||Sent: Tuesday, March 04, 2003 10:50 AM |||To: 'Log4J Users List' |||Subject: RE: Help with Logging (1.2.7) ||| ||| |||Just to make sure I understand: ||| |||The statement is completely correct when going to |||LightSpeed_Default |||appender; but then everything going to the |||LightSpeed_Console appender |||displays the characteristics you mention? Is it every |||message that you log |||to the console appender? ||| |||If so, my guess is that JBOSS is catching |||System.out/System.err and handling |||those itself. Never dealt with JBOSS. Have you asked |||this question on |||their mailing list? ||| ||| ||| ||| ||||-Original Message- ||||From: Corbin, James ||[mailto:[EMAIL PROTECTED] ||||Sent: Tuesday, March 04, 2003 10:20 AM ||||To: Log4J Users List ||||Subject: RE: Help with Logging (1.2.7) |||| |||| |||| ||||Thanks for the suggestion. I already have |all loggers ||||additivity set to ||||false, but my logging to the category still is ||appended to ||||a JBOSS INFO ||||message before being displayed
RE: Help with Logging (1.2.7)
hi, my definition for log4j in JBoss looks so: appender name=MMCMSFILE class=org.jboss.logging.appender.DailyRollingFileAppender param name=File value=${jboss.server.home.dir}/log/mmcms.log/ param name=Append value=true/ param name=Threshold value=DEBUG/ param name=DatePattern value='.'-MM-dd/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p [%c] %m%n/ /layout /appender category name=de.polonium additivity=false priority value=DEBUG/ appender-ref ref=MMCMSFILE/ /category I see debug print out from my code only in mmcms.log Best Regards, Rafal At 11:20 04.03.2003 -0500, Corbin, James wrote: Thanks for the suggestion. I already have all loggers additivity set to false, but my logging to the category still is appended to a JBOSS INFO message before being displayed. I must be doing something fundamentally wrong. Does anyone have a clue? I've read all the threads about this from the archive. It has given me some insight, but hasn't addressed my issue. Can somebody explain why I see the following behavior: JBOSS logging setup to log to console and file. I define a new category in my application logging config file then attach new console and file appender to the category. My application then logs to the category. If I make the following call: myCategory.debug( sometext ); Why does this get appended to a [INFO] message before being displayed to the console. This is not an additivity issue as I only get one entry in the log. If someone could help me understand why I see log entries like the following with my setup I might be able to fix it. Where is the 09:20:47,919 INFO [STDOUT] coming from Everything after that is the data from my call to log to the category. 09:20:47,919 INFO [STDOUT] 09:20:47,919,MyCategory[INFO ] - setSuccessfulForward = /SendHouseList -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 7:13 AM To: Log4J Users List Subject: RE: Help with Logging (1.2.7) Howdy, Set additivity to false for all your loggers, or alternatively for the root logger. Yoav Shapira Millennium ChemInformatics -Original Message- From: Corbin, James [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 6:30 PM To: Log4J Users List Subject: RE: Help with Logging (1.2.7) That would work, but I forgot to mention that our application is deployed on multiple server vendors and not just JBOSS. If it were, I would definitely not need to have a application specific configuration file. J.D. -Original Message- From: Rafal Kedziorski [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 4:08 PM To: Log4J Users List Subject: Re: Help with Logging (1.2.7) hi, why don't You use the log4j included to JBoss? I'm working with this and it works fine. Rafal At 16:39 03.03.2003 -0500, Corbin, James wrote: I am using Log4j version 1.2.7 as my application logging framework running on a JBOSS app server. The only issue I have run into is trying to define a separate configuration file that when loaded doesn't interfere with the one loaded at server startup by JBOSS. Therefore, I created the following configuration file which creates a category and my application logs to the category. This works as I've mentioned in previous emails, but the console log appends my messages to an INFO message (from JBOSS configuration?). I've included a log entry to demonstrate my issue: 14:36:14,648 INFO [STDOUT] 14:36:14,648,LightSpeed[DEBUG] - some message text My category name is LightSpeed. Notice how the [DEBUG] message is appended to a INFO [STDOUT] message? I assume this is coming from the JBOSS configuration of Log4j. Application Specific Configuration File * ## The server.log file appender for LightSpeed log4j.category.LightSpeed=DEBUG, LightSpeed_Console, LightSpeed_Default log4j.additivity.LightSpeed=false; log4j.appender.LightSpeed_Default=org.apache.log4j.RollingFileAppender log4j.appender.LightSpeed_Default.File=server.log log4j.appender.LightSpeed_Default.MaxFileSize=500KB log4j.appender.LightSpeed_Default.MaxBackupIndex=1 log4j.appender.LightSpeed_Default.layout=org.apache.log4j.PatternLayou t #log4j.appender.LightSpeed_Default.layout.ConversionPattern=%d %-5p [%t] %-17c{2} (%13F:%L) %3x - %m\n #log4j.appender.LightSpeed_Default.layout.ConversionPattern=[%d{ABSOLU TE}, % c {1}] %m%n log4j.appender.LightSpeed_Default.layout.ConversionPattern=%d{ABSOLUTE },%- 1 7 c [%-5p] - %m%n log4j.appender.LightSpeed_Console=org.apache.log4j.ConsoleAppender log4j.appender.LightSpeed_Console.layout=org.apache.log4j.PatternLayou t log4j.appender.LightSpeed_Console.layout.ConversionPattern=%d{ABSOLUTE },%- 1 7 c [%-5p] - %m%n _ J.D. Corbin Architecture and Emerging Systems Starwood Technology and Revenue Systems 9285 Teddy Lane, Suite 230 Lone Tree, CO 80124 Phone: 303.790.9551 Fax:303.790.9550 [EMAIL PROTECTED
RE: Help with Log4j automatic header generataion
I guess it depends on what the user really wants, but it seems that there should be some checking (or an option) to alter the behavior of writing a header to anything but a fresh file. I could see where you might want a continous log regardless of shutdown, and also where you may want a header to signal the restart of the log -Original Message- From: David Sanders [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 30, 2003 6:02 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: Help with Log4j automatic header generataion http://www.mail-archive.com/log4j-user@jakarta.apache.org/msg05953.html Thank you for the solution. One problem, though: If the logging process (JVM) is stopped and restarted, a 2nd header is written to the existing file. Example: - using DailyRollingFileAppender - logged record #1. Header was written first by MyPatternLayout. - logged record #2 - Stopped process - Started process - logged record #3. Header and record #3 were appended to existing file. I don't want the header written if it's not a new file. I'll see if PatternLayout can call theFile.length() and only write if length is 0. David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help with Log4j automatic header generataion
This issue has been reported before. If you come up with a fix, please submit it for review and inclusion in a future version of log4j. You might even want to write a bug. thanks, -Mark -Original Message- From: Klein, Scott @ TW [mailto:[EMAIL PROTECTED]] Sent: Friday, January 31, 2003 8:21 AM To: 'David Sanders'; Log4J-User (E-mail) Subject: RE: Help with Log4j automatic header generataion I guess it depends on what the user really wants, but it seems that there should be some checking (or an option) to alter the behavior of writing a header to anything but a fresh file. I could see where you might want a continous log regardless of shutdown, and also where you may want a header to signal the restart of the log -Original Message- From: David Sanders [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 30, 2003 6:02 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: Help with Log4j automatic header generataion http://www.mail-archive.com/log4j-user@jakarta.apache.org/msg0 5953.html Thank you for the solution. One problem, though: If the logging process (JVM) is stopped and restarted, a 2nd header is written to the existing file. Example: - using DailyRollingFileAppender - logged record #1. Header was written first by MyPatternLayout. - logged record #2 - Stopped process - Started process - logged record #3. Header and record #3 were appended to existing file. I don't want the header written if it's not a new file. I'll see if PatternLayout can call theFile.length() and only write if length is 0. David - 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: Help for starter..
I have another concern about our application maintaining conncetion pool and logger maintaining separate connection. what we expect is the logger to use either exisitng connection form pool or use the DAO layer itself. Can you help me how to proceed with that? Pls come with Any comments or suggestions of any kind regarding the same If you intend to maintain a pool of Loggers.. it is no need. Rich has already told how to make use of loggers in java. Find attachments. regards Madhav Amandeep Midha (CHARMIE) IT Solutions (India) Pvt. Ltd. No. 17, South End Road, Basavanudi Bangalore - 560 004. India TEL : 91-80-6657180 EXT: 2117 MOBILE: +919844048126 (Upto March 12, 2003) FAX: 91-80-6655755 - Visit my site @ http://newdelhi.topcities.com - Madhava Reddy Madhava_Reddy@ico To: 'Log4J Users List' [EMAIL PROTECTED] n-scm.com cc: Subject: RE: Help for starter.. 01/27/2003 12:31 AM Please respond to Log4J Users List Hi Mark and Rich, Thanks for the help.. It's working fine now. Madhav -Original Message- From: Rich Bagley [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 25, 2003 8:47 PM To: Log4J Users List Subject: RE: Help for starter.. Hi, I think the second xml is overwriting the appender attached to root. I'd use one xml file, with multiple appenders and loggers, something like this: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=DailyLog class=org.apache.log4j.DailyRollingFileAppender param name=File value=logs/multiple/LoginTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %m%n/ /layout /appender appender name=Request class=org.apache.log4j.DailyRollingFileAppender param name=File value=logs/multiple/RequestTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %m%n/ /layout /appender logger name=logging.request level value=debug/ appender-ref ref=Request/ /logger logger name=logging.dailyLog level value=debug/ appender-ref ref=DailyLog/ /logger root priority value=debug/ /root /log4j:configuration In your code: // Initialize the config // DOMConfigurator.configure( java/samples/xml/multiple/multi.xml ); // Get the loggers // Logger requestLogger = Logger.getLogger ( logging.request ); Logger dailyLogger = Logger.getLogger ( logging.dailyLog ); // Write to the logs // requestLogger.debug( request message1: DEBUG ); requestLogger.info( request message2: INFO ); dailyLogger.debug( dailyLog message1: DEBUG ); dailyLogger.info( dailyLog message2: INFO ); You'll get two log files. I've attached the xml file and a test class. Hope this helps -Rich -Original Message- From: Madhava Reddy [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 25, 2003 12:07 PM To: '[EMAIL PROTECTED]' Subject: Help for starter.. Hi, I'm fairly new to this Log4j. I have several questions. I am using Tomcat. I have jsps and java files. I planned to use 3 logs. I want to maintain Logs to Track Login Time, Logout Time in one log. Second log tracks Critical Requsts of all users. Third log tracks Exceptions and errors for all users. So, I am using DailyRollingFileAppender for these 3 logs. I am configuring logger by an xml file. Here is Loggin Track xml file. Login.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=DailyLog class=org.apache.log4j.DailyRollingFileAppender param name=File value=D:/tomcat4110/logs/smileLogs/LoginTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d % -5p %m%n/ /layout /appender root priority value=debug/ appender-ref ref=DailyLog/ /root /log4j:configuration --- and Request Track xml File -- ?xml
RE: Help for starter..
Hi Mark and Rich, Thanks for the help.. It's working fine now. Madhav -Original Message- From: Rich Bagley [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 25, 2003 8:47 PM To: Log4J Users List Subject: RE: Help for starter.. Hi, I think the second xml is overwriting the appender attached to root. I'd use one xml file, with multiple appenders and loggers, something like this: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=DailyLog class=org.apache.log4j.DailyRollingFileAppender param name=File value=logs/multiple/LoginTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %m%n/ /layout /appender appender name=Request class=org.apache.log4j.DailyRollingFileAppender param name=File value=logs/multiple/RequestTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %m%n/ /layout /appender logger name=logging.request level value=debug/ appender-ref ref=Request/ /logger logger name=logging.dailyLog level value=debug/ appender-ref ref=DailyLog/ /logger root priority value=debug/ /root /log4j:configuration In your code: // Initialize the config // DOMConfigurator.configure( java/samples/xml/multiple/multi.xml ); // Get the loggers // Logger requestLogger = Logger.getLogger( logging.request ); Logger dailyLogger = Logger.getLogger( logging.dailyLog ); // Write to the logs // requestLogger.debug( request message1: DEBUG ); requestLogger.info( request message2: INFO ); dailyLogger.debug( dailyLog message1: DEBUG ); dailyLogger.info( dailyLog message2: INFO ); You'll get two log files. I've attached the xml file and a test class. Hope this helps -Rich -Original Message- From: Madhava Reddy [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 25, 2003 12:07 PM To: '[EMAIL PROTECTED]' Subject: Help for starter.. Hi, I'm fairly new to this Log4j. I have several questions. I am using Tomcat. I have jsps and java files. I planned to use 3 logs. I want to maintain Logs to Track Login Time, Logout Time in one log. Second log tracks Critical Requsts of all users. Third log tracks Exceptions and errors for all users. So, I am using DailyRollingFileAppender for these 3 logs. I am configuring logger by an xml file. Here is Loggin Track xml file. Login.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=DailyLog class=org.apache.log4j.DailyRollingFileAppender param name=File value=D:/tomcat4110/logs/smileLogs/LoginTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %m%n/ /layout /appender root priority value=debug/ appender-ref ref=DailyLog/ /root /log4j:configuration --- and Request Track xml File -- ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=Request class=org.apache.log4j.DailyRollingFileAppender param name=File value=D:/tomcat4110/logs/smileLogs/RequestTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %m%n/ /layout /appender root priority value=debug/ appender-ref ref=Request/ /root /log4j:configuration - I create loggers in my java, like To get Login Track logger org.apache.log4j.xml.DOMConfigurator.configure(Login.xml); Logger loginLog = org.apache.log4j.Logger.getLogger(Login); and to get Request Logger org.apache.log4j.xml.DOMConfigurator.configure(Request.xml); Logger requestLog = org.apache.log4j.Logger.getLogger(Request); -- When I use these logs like loginLog.debug(Testing Login Track ); requestLog.debug( Testing Request Track ); --- I'm getting two log files namely LoginTrack.log and RequestTrack.log. But, LoginTrack is empty and RequestTrack.log contains, 2003-01-25 17:54:57,486 DEBUG Testing Login Track 2003-01-25 17:54:57,486 DEBUGTesting Request Log which means I am getting the same reference for the two
RE: Help for starter..
Hi all, It was a great help from Rich. I have another concern about our application maintaining conncetion pool and logger maintaining separate connection. what we expect is the logger to use either exisitng connection form pool or use the DAO layer itself. Can you help me how to proceed with that? Pls come with Any comments or suggestions of any kind regarding the same regards, Amandeep - Amandeep Midha (CHARMIE) IT Solutions (India) Pvt. Ltd. No. 17, South End Road, Basavanudi Bangalore - 560 004. India TEL : 91-80-6657180 EXT: 2117 MOBILE: +919844048126 (Upto March 12, 2003) FAX: 91-80-6655755 - Visit my site @ http://newdelhi.topcities.com - Madhava Reddy Madhava_Reddy@ico To: 'Log4J Users List' [EMAIL PROTECTED] n-scm.com cc: Subject: RE: Help for starter.. 01/27/2003 12:31 AM Please respond to Log4J Users List Hi Mark and Rich, Thanks for the help.. It's working fine now. Madhav -Original Message- From: Rich Bagley [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 25, 2003 8:47 PM To: Log4J Users List Subject: RE: Help for starter.. Hi, I think the second xml is overwriting the appender attached to root. I'd use one xml file, with multiple appenders and loggers, something like this: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=DailyLog class=org.apache.log4j.DailyRollingFileAppender param name=File value=logs/multiple/LoginTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %m%n/ /layout /appender appender name=Request class=org.apache.log4j.DailyRollingFileAppender param name=File value=logs/multiple/RequestTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %m%n/ /layout /appender logger name=logging.request level value=debug/ appender-ref ref=Request/ /logger logger name=logging.dailyLog level value=debug/ appender-ref ref=DailyLog/ /logger root priority value=debug/ /root /log4j:configuration In your code: // Initialize the config // DOMConfigurator.configure( java/samples/xml/multiple/multi.xml ); // Get the loggers // Logger requestLogger = Logger.getLogger ( logging.request ); Logger dailyLogger = Logger.getLogger ( logging.dailyLog ); // Write to the logs // requestLogger.debug( request message1: DEBUG ); requestLogger.info( request message2: INFO ); dailyLogger.debug( dailyLog message1: DEBUG ); dailyLogger.info( dailyLog message2: INFO ); You'll get two log files. I've attached the xml file and a test class. Hope this helps -Rich -Original Message- From: Madhava Reddy [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 25, 2003 12:07 PM To: '[EMAIL PROTECTED]' Subject: Help for starter.. Hi, I'm fairly new to this Log4j. I have several questions. I am using Tomcat. I have jsps and java files. I planned to use 3 logs. I want to maintain Logs to Track Login Time, Logout Time in one log. Second log tracks Critical Requsts of all users. Third log tracks Exceptions and errors for all users. So, I am using DailyRollingFileAppender for these 3 logs. I am configuring logger by an xml file
RE: Help for starter..
Sorry, mistake in my xml. Try this instead: logger name=Request additivity=false level value=debug/ appender-ref ref=Request/ /logger root priority value=debug/ appender-ref ref=DailyLog/ /root You can tell how often I actually change additivity. As penance I shall update the section in the wiki faq about the logger format. :-) -Mark -Original Message- From: Mark Womack Sent: Saturday, January 25, 2003 10:18 AM To: 'Log4J Users List' Subject: RE: Help for starter.. Configuring log4j with 2 or 3 different configuration files, the last configuration file will be in affect. You should probably combine the configuration files into a single file, and then add the following: logger name=Request priority value=debug/ appender-ref ref=Request/ param name=Additivity value=false/ /logger root priority value=debug/ appender-ref ref=DailyLog/ /root This makes it so that the logger Request only logs messges to the appender Request. Everything else is logged to DailyLog. Though it is not yet complete, I also recommend looking at the wiki documentation on xml configuration format located at: http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JXmlFormat We need a faq for DailyRollingAppender, etc. Anyone want to post a working example, or better yet, add the page to wiki? -Mark -Original Message- From: Madhava Reddy [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 25, 2003 9:07 AM To: '[EMAIL PROTECTED]' Subject: Help for starter.. Hi, I'm fairly new to this Log4j. I have several questions. I am using Tomcat. I have jsps and java files. I planned to use 3 logs. I want to maintain Logs to Track Login Time, Logout Time in one log. Second log tracks Critical Requsts of all users. Third log tracks Exceptions and errors for all users. So, I am using DailyRollingFileAppender for these 3 logs. I am configuring logger by an xml file. Here is Loggin Track xml file. Login.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=DailyLog class=org.apache.log4j.DailyRollingFileAppender param name=File value=D:/tomcat4110/logs/smileLogs/LoginTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %m%n/ /layout /appender root priority value=debug/ appender-ref ref=DailyLog/ /root /log4j:configuration --- and Request Track xml File -- ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=Request class=org.apache.log4j.DailyRollingFileAppender param name=File value=D:/tomcat4110/logs/smileLogs/RequestTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %m%n/ /layout /appender root priority value=debug/ appender-ref ref=Request/ /root /log4j:configuration - I create loggers in my java, like To get Login Track logger org.apache.log4j.xml.DOMConfigurator.configure(Login.xml); Logger loginLog = org.apache.log4j.Logger.getLogger(Login); and to get Request Logger org.apache.log4j.xml.DOMConfigurator.configure(Request.xml); Logger requestLog = org.apache.log4j.Logger.getLogger(Request); -- When I use these logs like loginLog.debug(Testing Login Track ); requestLog.debug( Testing Request Track ); --- I'm getting two log files namely LoginTrack.log and RequestTrack.log. But, LoginTrack is empty and RequestTrack.log contains, 2003-01-25 17:54:57,486 DEBUG Testing Login Track 2003-01-25 17:54:57,486 DEBUGTesting Request Log which means I am getting the same reference for the two loggers. What mistake I've done? How to get 2 different instances? I receive the name of Logger as argument in Java, if I have created this log, return existing, else I will create new logger and return. I will maintain loggers mapping looger name -- logger. Please point out any mistakes or wrong apprach in the above approach. Will this approach creates some problems at some later poing of time? --- One more question, Imagine, I have successfully running tomcat with these loggers. After some days, the loggers size may become critical. I observed that, I can not delete a log file with out stopping tomcat.. How to delete old log files
RE: Help for starter..
Hi, I think the second xml is overwriting the appender attached to root. I'd use one xml file, with multiple appenders and loggers, something like this: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=DailyLog class=org.apache.log4j.DailyRollingFileAppender param name=File value=logs/multiple/LoginTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %m%n/ /layout /appender appender name=Request class=org.apache.log4j.DailyRollingFileAppender param name=File value=logs/multiple/RequestTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %m%n/ /layout /appender logger name=logging.request level value=debug/ appender-ref ref=Request/ /logger logger name=logging.dailyLog level value=debug/ appender-ref ref=DailyLog/ /logger root priority value=debug/ /root /log4j:configuration In your code: // Initialize the config // DOMConfigurator.configure( java/samples/xml/multiple/multi.xml ); // Get the loggers // Logger requestLogger = Logger.getLogger( logging.request ); Logger dailyLogger = Logger.getLogger( logging.dailyLog ); // Write to the logs // requestLogger.debug( request message1: DEBUG ); requestLogger.info( request message2: INFO ); dailyLogger.debug( dailyLog message1: DEBUG ); dailyLogger.info( dailyLog message2: INFO ); You'll get two log files. I've attached the xml file and a test class. Hope this helps -Rich -Original Message- From: Madhava Reddy [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 25, 2003 12:07 PM To: '[EMAIL PROTECTED]' Subject: Help for starter.. Hi, I'm fairly new to this Log4j. I have several questions. I am using Tomcat. I have jsps and java files. I planned to use 3 logs. I want to maintain Logs to Track Login Time, Logout Time in one log. Second log tracks Critical Requsts of all users. Third log tracks Exceptions and errors for all users. So, I am using DailyRollingFileAppender for these 3 logs. I am configuring logger by an xml file. Here is Loggin Track xml file. Login.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=DailyLog class=org.apache.log4j.DailyRollingFileAppender param name=File value=D:/tomcat4110/logs/smileLogs/LoginTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %m%n/ /layout /appender root priority value=debug/ appender-ref ref=DailyLog/ /root /log4j:configuration --- and Request Track xml File -- ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=Request class=org.apache.log4j.DailyRollingFileAppender param name=File value=D:/tomcat4110/logs/smileLogs/RequestTrack.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %m%n/ /layout /appender root priority value=debug/ appender-ref ref=Request/ /root /log4j:configuration - I create loggers in my java, like To get Login Track logger org.apache.log4j.xml.DOMConfigurator.configure(Login.xml); Logger loginLog = org.apache.log4j.Logger.getLogger(Login); and to get Request Logger org.apache.log4j.xml.DOMConfigurator.configure(Request.xml); Logger requestLog = org.apache.log4j.Logger.getLogger(Request); -- When I use these logs like loginLog.debug(Testing Login Track ); requestLog.debug( Testing Request Track ); --- I'm getting two log files namely LoginTrack.log and RequestTrack.log. But, LoginTrack is empty and RequestTrack.log contains, 2003-01-25 17:54:57,486 DEBUG Testing Login Track 2003-01-25 17:54:57,486 DEBUGTesting Request Log which means I am getting the same reference for the two loggers. What mistake I've done? How to get 2 different instances? I receive the name of Logger as argument in Java, if I have created this log, return existing, else I will create new logger and return. I will maintain loggers
Re: Help !
Bonjour Sébastien I'm new to log4J as well, but what you're doing seems very complicated. Why do you do all the configuration in java code? I do it all in the config file. My code looks instance like: public class GererPage extends Action { static Logger logger = Logger.getLogger(GererPage.class.getName()); public GererPage() { logger.debug(creating new GererPage - + this.toString()); } bla,bla bla } I also have once in my application: void init() { PropertyConfigurator.configure(myfile.lcf); } This works fine to log messages. I haven't figured out whether you are trying to do something else in your trace function. Bonne chance, Neil - Original Message - From: Sébastien Hiblot [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 16, 2003 8:22 AM Subject: Help ! Hi, We're working on a java web site and we'd like to use log4j in order to log the error. We have made a class to implement the init of log4j. Here the source of this class : private Logger logger ; public Trace(String class_name) { logger = LogManager.getLogger(class_name); Layout layout = new PatternLayout(%d{MMdd-HH:mm:ss} %m%n); logger.addAppender(new ConsoleAppender(layout, ConsoleAppender.SYSTEM_OUT)); logger.setLevel(Level.DEBUG); try { logger.addAppender(new FileAppender(layout, (String) Ecx_constants.getInstance().get(log4j_fileTrace), true)); } catch (IOException e) { } To log something : Trace t = new Trace(this.getClass().toString()) ; t.debug(My message); The first time, we call the page, the log contain the good thing : 20030116-12:00:00 My message But the second time we call the page, 30 sec after, we have in the log: 20030116-12:00:00 My message 20030116-12:00:30 My message 20030116-12:00:30 My message == the log appears 2 times ! the third time, the log appears 3 time, etc.. Can you help us please ? Thx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help !
Step-by-step what is happening here is: First-call: 1) A logger with a name matching the given class_name does not exist, so log4j creates it. 2) Two appenders are added to the logger (a console appender and a file appender). Second-call: 1) A logger with a name matching the given class name already exists (it was created above), so that logger is returned (including the two appenders previously attached) 2) Two appenders are added to the logger (a console appender and a file appender). Etc... Assuming that there is a vaild reason you need to wrap all these log4j calls inside your own hand-rolled class, then try something like the following code change in the constructor: public Trace( String class_name ) { if (!LogManager.exists( class_name )) { logger = LogManager.getLogger(class_name); Layout layout = new PatternLayout(%d{MMdd-HH:mm:ss} %m%n); logger.addAppender(new ConsoleAppender(layout, ConsoleAppender.SYSTEM_OUT)); logger.setLevel(Level.DEBUG); try { logger.addAppender(new FileAppender(layout, (String)Ecx_constants.getInstance().get(log4j_fileTrace), true)); } catch (IOException e) {} } } But the better solution is to perform initialization of the log4j library through config files. |-Original Message- |From: Sébastien Hiblot [mailto:[EMAIL PROTECTED]] |Sent: Thursday, January 16, 2003 7:22 AM |To: [EMAIL PROTECTED] |Subject: Help ! | | |Hi, | |We're working on a java web site and we'd like to use |log4j in order |to log the error. | |We have made a class to implement the init of log4j. Here |the source of this |class : | |private Logger logger ; | |public Trace(String class_name) { | logger = LogManager.getLogger(class_name); | Layout layout = new |PatternLayout(%d{MMdd-HH:mm:ss} %m%n); | logger.addAppender(new ConsoleAppender(layout, |ConsoleAppender.SYSTEM_OUT)); | logger.setLevel(Level.DEBUG); | try { | logger.addAppender(new FileAppender(layout, (String) |Ecx_constants.getInstance().get(log4j_fileTrace), true)); | } catch (IOException e) { |} | |To log something : |Trace t = new Trace(this.getClass().toString()) ; |t.debug(My message); | |The first time, we call the page, the log contain the good thing : |20030116-12:00:00 My message | |But the second time we call the page, 30 sec after, we |have in the log: |20030116-12:00:00 My message |20030116-12:00:30 My message |20030116-12:00:30 My message | |== the log appears 2 times ! |the third time, the log appears 3 time, etc.. | |Can you help us please ? | |Thx | | |-- |To unsubscribe, e-mail: |mailto:[EMAIL PROTECTED] |For additional commands, e-mail: |mailto:[EMAIL PROTECTED] | -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help !
Thx a lot !!! the problem was that we always add the appenders. So, the first time it's ok but after, we always add the two appenders. Now we use the exists method in order to know if the logger exists. if not, we create the logger and then add the appenders. if exists, we do nothing ! You ask why we make the config in the java code. For our java web site, we use Weblogic and ear file. We have to specify and modify easily some parameter without deploying the ear file like the level, the file where we write, the repository where is the xml containing the message. But with a config file, we can't change easily this parameters, we have to deploy the ear, make the modification and then rebuild the ear ! Thx a lot for your help. -Message d'origine- De : Ebersole, Steven [mailto:[EMAIL PROTECTED]] Envoyé : jeudi 16 janvier 2003 14:54 À : 'Log4J Users List' Objet : RE: Help ! Step-by-step what is happening here is: First-call: 1) A logger with a name matching the given class_name does not exist, so log4j creates it. 2) Two appenders are added to the logger (a console appender and a file appender). Second-call: 1) A logger with a name matching the given class name already exists (it was created above), so that logger is returned (including the two appenders previously attached) 2) Two appenders are added to the logger (a console appender and a file appender). Etc... Assuming that there is a vaild reason you need to wrap all these log4j calls inside your own hand-rolled class, then try something like the following code change in the constructor: public Trace( String class_name ) { if (!LogManager.exists( class_name )) { logger = LogManager.getLogger(class_name); Layout layout = new PatternLayout(%d{MMdd-HH:mm:ss} %m%n); logger.addAppender(new ConsoleAppender(layout, ConsoleAppender.SYSTEM_OUT)); logger.setLevel(Level.DEBUG); try { logger.addAppender(new FileAppender(layout, (String)Ecx_constants.getInstance().get(log4j_fileTrace), true)); } catch (IOException e) {} } } But the better solution is to perform initialization of the log4j library through config files. |-Original Message- |From: Sébastien Hiblot [mailto:[EMAIL PROTECTED]] |Sent: Thursday, January 16, 2003 7:22 AM |To: [EMAIL PROTECTED] |Subject: Help ! | | |Hi, | |We're working on a java web site and we'd like to use |log4j in order |to log the error. | |We have made a class to implement the init of log4j. Here |the source of this |class : | |private Logger logger ; | |public Trace(String class_name) { | logger = LogManager.getLogger(class_name); | Layout layout = new |PatternLayout(%d{MMdd-HH:mm:ss} %m%n); | logger.addAppender(new ConsoleAppender(layout, |ConsoleAppender.SYSTEM_OUT)); | logger.setLevel(Level.DEBUG); | try { | logger.addAppender(new FileAppender(layout, (String) |Ecx_constants.getInstance().get(log4j_fileTrace), true)); | } catch (IOException e) { |} | |To log something : |Trace t = new Trace(this.getClass().toString()) ; |t.debug(My message); | |The first time, we call the page, the log contain the good thing : |20030116-12:00:00 My message | |But the second time we call the page, 30 sec after, we |have in the log: |20030116-12:00:00 My message |20030116-12:00:30 My message |20030116-12:00:30 My message | |== the log appears 2 times ! |the third time, the log appears 3 time, etc.. | |Can you help us please ? | |Thx | | |-- |To unsubscribe, e-mail: |mailto:[EMAIL PROTECTED] |For additional commands, e-mail: |mailto:[EMAIL PROTECTED] | -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help !
I also use Weblogic and war/ear file deployment. However, I just wrote a simple little set of JSPs to allow dynamic overrides of the level for defined appenders. This is particular useful for things like user-specific loggers... However, I let log4j initialize itself initially from its config files. Just some thoughts... |-Original Message- |From: Sébastien Hiblot [mailto:[EMAIL PROTECTED]] |Sent: Thursday, January 16, 2003 9:20 AM |To: Log4J Users List |Subject: RE: Help ! | | |Thx a lot !!! |the problem was that we always add the appenders. So, the |first time it's ok |but after, we always add the two appenders. | |Now we use the exists method in order to know if the logger exists. |if not, we create the logger and then add the appenders. |if exists, we do nothing ! | |You ask why we make the config in the java code. |For our java web site, we use Weblogic and ear file. |We have to specify and modify easily some parameter |without deploying the |ear file like the level, |the file where we write, the repository where is the xml |containing the |message. | |But with a config file, we can't change easily this |parameters, we have to |deploy the ear, make the modification |and then rebuild the ear ! | |Thx a lot for your help. | | | -Message d'origine- | De : Ebersole, Steven [mailto:[EMAIL PROTECTED]] | Envoyé : jeudi 16 janvier 2003 14:54 | À : 'Log4J Users List' | Objet : RE: Help ! | | | Step-by-step what is happening here is: | | First-call: | 1) A logger with a name matching the given class_name |does not exist, so | log4j creates it. | 2) Two appenders are added to the logger (a console |appender and a file | appender). | | Second-call: | 1) A logger with a name matching the given class name already | exists (it was | created above), so that logger is returned (including |the two appenders | previously attached) | 2) Two appenders are added to the logger (a console |appender and a file | appender). | | Etc... | | | Assuming that there is a vaild reason you need to wrap all these | log4j calls | inside your own hand-rolled class, then try something |like the following | code change in the constructor: | | | public Trace( String class_name ) | { | if (!LogManager.exists( class_name )) | { | logger = LogManager.getLogger(class_name); | Layout layout = new | PatternLayout(%d{MMdd-HH:mm:ss} %m%n); | logger.addAppender(new ConsoleAppender(layout, | ConsoleAppender.SYSTEM_OUT)); |logger.setLevel(Level.DEBUG); | try | { | logger.addAppender(new FileAppender(layout, | |(String)Ecx_constants.getInstance().get(log4j_fileTrace), true)); |} | catch (IOException e) | {} | } | } | | But the better solution is to perform initialization of |the log4j library | through config files. | | | | | | |-Original Message- | |From: Sébastien Hiblot |[mailto:[EMAIL PROTECTED]] | |Sent: Thursday, January 16, 2003 7:22 AM | |To: [EMAIL PROTECTED] | |Subject: Help ! | | | | | |Hi, | | | |We're working on a java web site and we'd like to use | |log4j in order | |to log the error. | | | |We have made a class to implement the init of log4j. Here | |the source of this | |class : | | | |private Logger logger ; | | | |public Trace(String class_name) { | |logger = LogManager.getLogger(class_name); | | Layout layout = new | |PatternLayout(%d{MMdd-HH:mm:ss} %m%n); | | logger.addAppender(new ConsoleAppender(layout, | |ConsoleAppender.SYSTEM_OUT)); | | logger.setLevel(Level.DEBUG); | | try { | |logger.addAppender(new |FileAppender(layout, (String) | |Ecx_constants.getInstance().get(log4j_fileTrace), true)); | | } catch (IOException e) { | |} | | | |To log something : | |Trace t = new Trace(this.getClass().toString()) ; | |t.debug(My message); | | | |The first time, we call the page, the log contain |the good thing : | |20030116-12:00:00 My message | | | |But the second time we call the page, 30 sec after, we | |have in the log: | |20030116-12:00:00 My message | |20030116-12:00:30 My message | |20030116-12:00:30 My message | | | |== the log appears 2 times ! | |the third time
Re: Help required on log4j implementation using WebSphere 4.0
John: I'm sure there are a number of ways to do it, but we've been putting the .properties file in the same directory as the java class file (com.xxx.xxx.class) and using InputStream is = getClass().getResourceAsStream(mylog.properties); We're using this for servlets and EJBs. Tom Hi All, I getting following error when i try to implement log4j on WebSphere 4.0. I put the log4j jar in the web-inf/lib directory. and the log4j.properties file i tried to put it under web-inf/classes directory, when the Test Environment starts it automatically deletes the properties file. and gives the error. Can someone give some help on this. log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester). log4j:WARN Please initialize the log4j system properly. regards, John Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- NeoMail - Webmail that doesn't suck... as much. http://neomail.sourceforge.net -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help with Log4j automatic header generataion
Very simple - Just extend PatternLayout (thats what your example looks like), or any other layout and over-ride the getHeader() and/or getFooter() methods. Then just name your class as the layout in the config file. scott -- ex --- public class MyPatternLayout extends PatternLayout { public MyPatternLayout() { super(); } public String getHeader() { Date now = new Date(); SimpleDateFormat sdf = new SimpleDateFormat( .MM.dd 'at' HH:mm:ss.SSS z ); StringBuffer buf = new StringBuffer(); buf.append( === My Log File ===\r\n ); buf.append( Log started: ); buf.append( sdf.format( now ) ); buf.append( \r\n ); buf.append( ReleaseVersion.getVersionString() ); buf.append( \r\n\r\n ); String superHeader = super.getHeader(); if ( superHeader != null ) { buf.append( superHeader ); } return new String(buf); } } -Original Message- From: McKinnon, Cory [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 6:32 AM To: '[EMAIL PROTECTED]' Subject: Help with Log4j automatic header generataion Hi, I am simply prototyping a very small Log4j application, however, one of the requirements we must prove to the client is for an automatic header generation for the log messages. Example: DATEFUNCCLASS / LINE NUMBERLVL MESSAGE 2002-07-29 15:26:08,086 [main] (log4jexample.TestLogging : 16) DEBUG - message1 2002-07-29 15:26:08,101 [main] (log4jexample.TestLogging : 17) INFO - message 2002-07-29 15:26:08,101 [main] (log4jexample.TestLogging : 18) WARN - message3 2002-07-29 15:26:08,101 [main] (log4jexample.TestLogging : 19) ERROR - message4 2002-07-29 15:26:08,164 [main] (log4jexample.TestLogging : 20) FATAL - message5 Any help is much appreciated. Cheers, Cory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help required Urgently: og4j:WARN No appenders could be found for logger issue
Thanks to the forum,We finally solved the issue. The the logger class had problems in the getLogger method . Regds Sri -Original Message- From: srividyar Sent: Saturday, July 06, 2002 2:10 AM To: '[EMAIL PROTECTED]' Subject: Help required Urgently: og4j:WARN No appenders could be found for logger issue Environment : WAS 4.0, Log4j 1.2rc1 I am repeatedly getting the message log4j:WARN No appenders could be found for logger, I have double checked my config file, unable to find any issues with it. Here's the snapshot of the console output *] log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader@5531ef88. log4j: Trying to find [log4j.properties] using sun.misc.Launcher$AppClassLoader@5531ef88 class loader. log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource(). log4j: Could not find resource: [log4j.properties]. log4j: System property is :null log4j: Standard DocumentBuilderFactory search succeded. log4j: DocumentBuilderFactory is: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl log4j: URL to log4j.dtd is [jar:file:/C:/jars/log4j-1.2rc1.jar!/org/apache/log4j/xml/log4j.dtd]. log4j: debug attribute= true. log4j: Threshold =null. log4j: Retreiving an instance of org.apache.log4j.Logger. log4j: Setting [bpt] additivity to [true]. log4j: Level value for bpt is [info]. log4j: bpt level set to INFO log4j: Class name: [com.inf.common.audit.controller.logservices.ABDailyRollingFileAppender] log4j: Setting property [file] to [r.log]. log4j: Setting property [datePattern] to [-MM-dd-HH-mm]. log4j: Setting property [layoutType] to [xml]. log4j: Parsing layout of class: com.inf.common.audit.controller.logservices.ABXMLLayout log4j: setFile called: r.log, true log4j: setFile ended log4j: Appender [A1] to be rolled every minute. log4j: Adding appender named [A1] to category [bpt]. log4j: Level value for root is [info]. log4j: root level set to INFO log4j: Adding appender named [A1] to category [root]. Inside the private constructore of LoggerManager Hellow bptFactory nameclass com.inf.common.audit.controller.logservices.ABLoggerFactory ###Before calling the call appenders HELLO log4j:WARN No appenders could be found for logger (bpt).after the call log4j:WARN Please initialize the log4j system properly. *] I am using DomConifgurator to read the xml file. here's the snaphot of the config file *] ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration debug = true xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=A1 class=com.inf.common.audit.controller.logservices.ABDailyRollingFileAppender param name=File value=r.log / param name=DatePattern value=-MM-dd-HH-mm / param name=LayoutType value=xml/ layout class=com.inf.common.audit.controller.logservices.ABXMLLayout /layout /appender category name=bpt additivity = true priority value=info/ appender-ref ref=A1/ /category root priority value =info/ appender-ref ref=A1/ /root /log4j:configuration *] What i dont understand is that the file seems to be read completely.On the design front this is how are doing it.We have extended the Logger, LoggerManager,XMLlayout,Level,Dailyrollingfileappender,Repositoryselector and the Loggerfactory. The extension are for the following 1) to provide for a duration based logging 2) to provide for a configurable layout type(XML/txt) 3) to have logical hierarchies 4) custom level off below info and on above info. 5) choice of appender between daily rolling file and JMS appender depending on deployment. tks Sri -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Help required Urgently: og4j:WARN No appenders could be found for logger issue
Have you tested your Logger subclass properly? At 02:10 06.07.2002 +0530, you wrote: Environment : WAS 4.0, Log4j 1.2rc1 I am repeatedly getting the message log4j:WARN No appenders could be found for logger, I have double checked my config file, unable to find any issues with it. Here's the snapshot of the console output *] log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader@5531ef88. log4j: Trying to find [log4j.properties] using sun.misc.Launcher$AppClassLoader@5531ef88 class loader. log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource(). log4j: Could not find resource: [log4j.properties]. log4j: System property is :null log4j: Standard DocumentBuilderFactory search succeded. log4j: DocumentBuilderFactory is: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl log4j: URL to log4j.dtd is [jar:file:/C:/jars/log4j-1.2rc1.jar!/org/apache/log4j/xml/log4j.dtd]. log4j: debug attribute= true. log4j: Threshold =null. log4j: Retreiving an instance of org.apache.log4j.Logger. log4j: Setting [bpt] additivity to [true]. log4j: Level value for bpt is [info]. log4j: bpt level set to INFO log4j: Class name: [com.inf.common.audit.controller.logservices.ABDailyRollingFileAppender] log4j: Setting property [file] to [r.log]. log4j: Setting property [datePattern] to [-MM-dd-HH-mm]. log4j: Setting property [layoutType] to [xml]. log4j: Parsing layout of class: com.inf.common.audit.controller.logservices.ABXMLLayout log4j: setFile called: r.log, true log4j: setFile ended log4j: Appender [A1] to be rolled every minute. log4j: Adding appender named [A1] to category [bpt]. log4j: Level value for root is [info]. log4j: root level set to INFO log4j: Adding appender named [A1] to category [root]. Inside the private constructore of LoggerManager Hellow bptFactory nameclass com.inf.common.audit.controller.logservices.ABLoggerFactory ###Before calling the call appenders HELLO log4j:WARN No appenders could be found for logger (bpt).after the call log4j:WARN Please initialize the log4j system properly. *] I am using DomConifgurator to read the xml file. here's the snaphot of the config file *] ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration debug = true xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=A1 class=com.inf.common.audit.controller.logservices.ABDailyRollingFileAppender param name=File value=r.log / param name=DatePattern value=-MM-dd-HH-mm / param name=LayoutType value=xml/ layout class=com.inf.common.audit.controller.logservices.ABXMLLayout /layout /appender category name=bpt additivity = true priority value=info/ appender-ref ref=A1/ /category root priority value =info/ appender-ref ref=A1/ /root /log4j:configuration *] What i dont understand is that the file seems to be read completely.On the design front this is how are doing it.We have extended the Logger, LoggerManager,XMLlayout,Level,Dailyrollingfileappender,Repositoryselector and the Loggerfactory. The extension are for the following 1) to provide for a duration based logging 2) to provide for a configurable layout type(XML/txt) 3) to have logical hierarchies 4) custom level off below info and on above info. 5) choice of appender between daily rolling file and JMS appender depending on deployment. tks Sri -- Ceki -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Help required Urgently: og4j:WARN No appenders could be found for logger issue
At 02:10 06.07.2002 +0530, you wrote: The extension are for the following 4) custom level off below info and on above info. This might bite you very hard in the future. It is a bad idea to extend Logger to support new level types. You should use the Logger.log method instead as in: logger.log(Your.custom.level, your message); The problem stems from the fact that the logger repository might be set by the EJB Container and not your application. In that situation the logger instances returned by Logger.getLogger might be incompatible with what your application expects, i.e. you will get a NoSuchMethodException when your application accesses info+() or info-() methods. -- Ceki -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help to configure Log4j with example
At 17:43 11.04.2002 -0700, you wrote: Maybee the only thing we need is to break down the manual into several htmls with an index and have a section like Getting started for the really impatient or something of the kind. What do you guys think: I think we should consider doing this. I do like the focus of Dave's document, ie here's what you have to do to get up and running, here is an extremely simple example, boom you're off. I would also like to see a section like where to go from here, frequently asked questions about extending log4j that would cover writing custom appenders, levels, filters, etc. Doesn't have to be detailed start to finish, but points folks in the right direction. And a discussion about using xml configuration files and the DOMConfigurator. Whatever we do now can be extended over time, too. Maybe a faq on steroids is more the format? Ceki, do you mind if we use/break up your article as a source for the mini-manual? No, I don't mind. In any case, the short manual is licensed under the Apache Software License even if it it does not say so. (I'll add the license information). On the other hand, wouldn't it be more useful if you made your additions to the existing manual directly. Moreover, if you look at http://jakarta.apache.org/log4j/docs/documentation.html you will see that there are already a number of short articles from third parties. My suggestion would be to work and improve the existing manual rather than starting a new effort. Or am I missing something here? -- Ceki -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help to configure Log4j with example
First, Ceki is right. There is a lot of good information in the short manual. That article has a great introduction to logging generally and nicely goes into detail about the major pieces of log4j. I don't think it needs to be broken up. But I also agree that first- and second-time users would benefit by having the how-to recipe to get started, with follow ups on each of the major areas, also in a cookbook style approach. I'd certainly be willing to take a stab at those if I'm not stepping on anyone's toes. Different people learn in different ways, so having a 'how to' recipe approach as well as the short manual would serve log4j users well. I agree also that the how-to should end with a where to go from here... set of links. But I think the very next level would be just a step beyond the beginner stuff and make the write-your-own stuff a subsequent level. So, for example, the first how-to has among its next steps links a link to a document on Appenders and what they are and how to use the existing ones. That in turn could link to how to write your own Appenders. Dave -Original Message- From: Ceki Gulcu [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 2:38 AM To: Log4J Users List Subject: RE: Help to configure Log4j with example At 17:43 11.04.2002 -0700, you wrote: Maybee the only thing we need is to break down the manual into several htmls with an index and have a section like Getting started for the really impatient or something of the kind. What do you guys think: I think we should consider doing this. I do like the focus of Dave's document, ie here's what you have to do to get up and running, here is an extremely simple example, boom you're off. I would also like to see a section like where to go from here, frequently asked questions about extending log4j that would cover writing custom appenders, levels, filters, etc. Doesn't have to be detailed start to finish, but points folks in the right direction. And a discussion about using xml configuration files and the DOMConfigurator. Whatever we do now can be extended over time, too. Maybe a faq on steroids is more the format? Ceki, do you mind if we use/break up your article as a source for the mini-manual? No, I don't mind. In any case, the short manual is licensed under the Apache Software License even if it it does not say so. (I'll add the license information). On the other hand, wouldn't it be more useful if you made your additions to the existing manual directly. Moreover, if you look at http://jakarta.apache.org/log4j/docs/documentation.html you will see that there are already a number of short articles from third parties. My suggestion would be to work and improve the existing manual rather than starting a new effort. Or am I missing something here? -- Ceki -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help to configure Log4j with example
Dave, if you have time to cook something up, go for it. I think you are on the right track. We can keep our toes out of harms way. Maybe people just haven't found Ceki's article and taken the time to read it. Maybe we need to redesign the layout of the web pages so folks can find things better, but I think your point about people approaching new stuff differently is valid. I know it took me some time to get my feet on the ground, so whatever we can do to help in this regard will potentially increase the adoption of log4j and the level of dicussion on the mailing list. thanks, -Mark -Original Message- From: Dave Bender [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 7:29 AM To: Log4J Users List Subject: RE: Help to configure Log4j with example First, Ceki is right. There is a lot of good information in the short manual. That article has a great introduction to logging generally and nicely goes into detail about the major pieces of log4j. I don't think it needs to be broken up. But I also agree that first- and second-time users would benefit by having the how-to recipe to get started, with follow ups on each of the major areas, also in a cookbook style approach. I'd certainly be willing to take a stab at those if I'm not stepping on anyone's toes. Different people learn in different ways, so having a 'how to' recipe approach as well as the short manual would serve log4j users well. I agree also that the how-to should end with a where to go from here... set of links. But I think the very next level would be just a step beyond the beginner stuff and make the write-your-own stuff a subsequent level. So, for example, the first how-to has among its next steps links a link to a document on Appenders and what they are and how to use the existing ones. That in turn could link to how to write your own Appenders. Dave -Original Message- From: Ceki Gulcu [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 2:38 AM To: Log4J Users List Subject: RE: Help to configure Log4j with example At 17:43 11.04.2002 -0700, you wrote: Maybee the only thing we need is to break down the manual into several htmls with an index and have a section like Getting started for the really impatient or something of the kind. What do you guys think: I think we should consider doing this. I do like the focus of Dave's document, ie here's what you have to do to get up and running, here is an extremely simple example, boom you're off. I would also like to see a section like where to go from here, frequently asked questions about extending log4j that would cover writing custom appenders, levels, filters, etc. Doesn't have to be detailed start to finish, but points folks in the right direction. And a discussion about using xml configuration files and the DOMConfigurator. Whatever we do now can be extended over time, too. Maybe a faq on steroids is more the format? Ceki, do you mind if we use/break up your article as a source for the mini-manual? No, I don't mind. In any case, the short manual is licensed under the Apache Software License even if it it does not say so. (I'll add the license information). On the other hand, wouldn't it be more useful if you made your additions to the existing manual directly. Moreover, if you look at http://jakarta.apache.org/log4j/docs/documentation.html you will see that there are already a number of short articles from third parties. My suggestion would be to work and improve the existing manual rather than starting a new effort. Or am I missing something here? -- Ceki -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help to configure Log4j with example
Hi all, I think it all boils down to this. 1. If I need Log4j just as a logging utility and I need it FAST, a short cookbook would be of great help 2. Provided the powers of Log4j mentioned in the introduction, Where-To links would be of great help if I want to extend usage in future. So, I think we can stop further discussion on this and get back to implementing it :-) -Cheers Gautham -Original Message- From: Mark Womack [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 9:46 AM To: 'Log4J Users List' Subject: RE: Help to configure Log4j with example Dave, if you have time to cook something up, go for it. I think you are on the right track. We can keep our toes out of harms way. Maybe people just haven't found Ceki's article and taken the time to read it. Maybe we need to redesign the layout of the web pages so folks can find things better, but I think your point about people approaching new stuff differently is valid. I know it took me some time to get my feet on the ground, so whatever we can do to help in this regard will potentially increase the adoption of log4j and the level of dicussion on the mailing list. thanks, -Mark -Original Message- From: Dave Bender [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 7:29 AM To: Log4J Users List Subject: RE: Help to configure Log4j with example First, Ceki is right. There is a lot of good information in the short manual. That article has a great introduction to logging generally and nicely goes into detail about the major pieces of log4j. I don't think it needs to be broken up. But I also agree that first- and second-time users would benefit by having the how-to recipe to get started, with follow ups on each of the major areas, also in a cookbook style approach. I'd certainly be willing to take a stab at those if I'm not stepping on anyone's toes. Different people learn in different ways, so having a 'how to' recipe approach as well as the short manual would serve log4j users well. I agree also that the how-to should end with a where to go from here... set of links. But I think the very next level would be just a step beyond the beginner stuff and make the write-your-own stuff a subsequent level. So, for example, the first how-to has among its next steps links a link to a document on Appenders and what they are and how to use the existing ones. That in turn could link to how to write your own Appenders. Dave -Original Message- From: Ceki Gulcu [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 2:38 AM To: Log4J Users List Subject: RE: Help to configure Log4j with example At 17:43 11.04.2002 -0700, you wrote: Maybee the only thing we need is to break down the manual into several htmls with an index and have a section like Getting started for the really impatient or something of the kind. What do you guys think: I think we should consider doing this. I do like the focus of Dave's document, ie here's what you have to do to get up and running, here is an extremely simple example, boom you're off. I would also like to see a section like where to go from here, frequently asked questions about extending log4j that would cover writing custom appenders, levels, filters, etc. Doesn't have to be detailed start to finish, but points folks in the right direction. And a discussion about using xml configuration files and the DOMConfigurator. Whatever we do now can be extended over time, too. Maybe a faq on steroids is more the format? Ceki, do you mind if we use/break up your article as a source for the mini-manual? No, I don't mind. In any case, the short manual is licensed under the Apache Software License even if it it does not say so. (I'll add the license information). On the other hand, wouldn't it be more useful if you made your additions to the existing manual directly. Moreover, if you look at http://jakarta.apache.org/log4j/docs/documentation.html you will see that there are already a number of short articles from third parties. My suggestion would be to work and improve the existing manual rather than starting a new effort. Or am I missing something here? -- Ceki -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help to configure Log4j with example
I had the same frustrations. The manual is a nice article, but it's not easy to get started using the program. When I saw your post, I whipped together the attached HTML document, which should help out you and anyone else who's just getting started. I'm not an expert with the package, and I haven't had a second set of eyes look over this simple how-to, but if there are other eyes there, please feel free to post any corrections. David Bender [EMAIL PROTECTED] -Original Message- From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 3:51 PM To: Log4J Users List Subject: Help to configure Log4j with example Hi, i am new to this log4j, i just downloaded log4j1.2beta4 and was trying to figure how to use it in my application. I am building an intranet site using jsp, servlets, and beans, i want to log the error, info, and debug messages generated from java classes can anyone send me some java code which shows how log4j has been used, i would like to have the output from log4j in XML format. i read the manual and was not able to figure out how to make this thing work, also i read the documentation with same result. i really need some advice in lehman language to put this thing working ASAP Ashish __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help to configure Log4j with example
Hi David, Thanx for the mail, but The attachment did not come through, can u please resend the attachment, can also send a CC to my other account as some times i dont get attachements on yahoo [EMAIL PROTECTED] Ashish --- Dave Bender [EMAIL PROTECTED] wrote: I had the same frustrations. The manual is a nice article, but it's not easy to get started using the program. When I saw your post, I whipped together the attached HTML document, which should help out you and anyone else who's just getting started. I'm not an expert with the package, and I haven't had a second set of eyes look over this simple how-to, but if there are other eyes there, please feel free to post any corrections. David Bender [EMAIL PROTECTED] -Original Message- From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 3:51 PM To: Log4J Users List Subject: Help to configure Log4j with example Hi, i am new to this log4j, i just downloaded log4j1.2beta4 and was trying to figure how to use it in my application. I am building an intranet site using jsp, servlets, and beans, i want to log the error, info, and debug messages generated from java classes can anyone send me some java code which shows how log4j has been used, i would like to have the output from log4j in XML format. i read the manual and was not able to figure out how to make this thing work, also i read the documentation with same result. i really need some advice in lehman language to put this thing working ASAP Ashish __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help to configure Log4j with example
Oh yes! I think getting a simple User manual makes a lot of lives easier. I can still recollect the trouble I had in my initial days of Log4j usage. I hope someone adds it to the official documents list and opens it for public usage. -Original Message- From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 1:51 PM To: Log4J Users List Subject: Help to configure Log4j with example Hi, i am new to this log4j, i just downloaded log4j1.2beta4 and was trying to figure how to use it in my application. I am building an intranet site using jsp, servlets, and beans, i want to log the error, info, and debug messages generated from java classes can anyone send me some java code which shows how log4j has been used, i would like to have the output from log4j in XML format. i read the manual and was not able to figure out how to make this thing work, also i read the documentation with same result. i really need some advice in lehman language to put this thing working ASAP Ashish __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help to configure Log4j with example
Maybe we should start with Dave's, edit and expand it and then submit it for future inclusion. Dave, I didn't get your html enclosure either. -Mark -Original Message- From: Gautham [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 3:29 PM To: Log4J Users List Subject: RE: Help to configure Log4j with example Oh yes! I think getting a simple User manual makes a lot of lives easier. I can still recollect the trouble I had in my initial days of Log4j usage. I hope someone adds it to the official documents list and opens it for public usage. -Original Message- From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 1:51 PM To: Log4J Users List Subject: Help to configure Log4j with example Hi, i am new to this log4j, i just downloaded log4j1.2beta4 and was trying to figure how to use it in my application. I am building an intranet site using jsp, servlets, and beans, i want to log the error, info, and debug messages generated from java classes can anyone send me some java code which shows how log4j has been used, i would like to have the output from log4j in XML format. i read the manual and was not able to figure out how to make this thing work, also i read the documentation with same result. i really need some advice in lehman language to put this thing working ASAP Ashish __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help to configure Log4j with example
Hmm. All the more reason to post it on a web site, I suppose I'll attach it again and cc you. As I mentioned, it could use a second person's look to make sure there are no mistakes. I'd want someone knowledgeable to check it over before posting it. Dave Bender [EMAIL PROTECTED] -Original Message- From: Mark Womack [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 5:32 PM To: 'Log4J Users List' Subject: RE: Help to configure Log4j with example Maybe we should start with Dave's, edit and expand it and then submit it for future inclusion. Dave, I didn't get your html enclosure either. -Mark -Original Message- From: Gautham [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 3:29 PM To: Log4J Users List Subject: RE: Help to configure Log4j with example Oh yes! I think getting a simple User manual makes a lot of lives easier. I can still recollect the trouble I had in my initial days of Log4j usage. I hope someone adds it to the official documents list and opens it for public usage. -Original Message- From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 1:51 PM To: Log4J Users List Subject: Help to configure Log4j with example Hi, i am new to this log4j, i just downloaded log4j1.2beta4 and was trying to figure how to use it in my application. I am building an intranet site using jsp, servlets, and beans, i want to log the error, info, and debug messages generated from java classes can anyone send me some java code which shows how log4j has been used, i would like to have the output from log4j in XML format. i read the manual and was not able to figure out how to make this thing work, also i read the documentation with same result. i really need some advice in lehman language to put this thing working ASAP Ashish __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help to configure Log4j with example
I was told the apache lists filter out HTML attachments, thinking they are likely spam. Save it as a .html.txt or something, to resend. regards Adam -Original Message- From: Mark Womack [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 4:32 PM To: 'Log4J Users List' Subject: RE: Help to configure Log4j with example Maybe we should start with Dave's, edit and expand it and then submit it for future inclusion. Dave, I didn't get your html enclosure either. -Mark -Original Message- From: Gautham [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 3:29 PM To: Log4J Users List Subject: RE: Help to configure Log4j with example Oh yes! I think getting a simple User manual makes a lot of lives easier. I can still recollect the trouble I had in my initial days of Log4j usage. I hope someone adds it to the official documents list and opens it for public usage. -Original Message- From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 1:51 PM To: Log4J Users List Subject: Help to configure Log4j with example Hi, i am new to this log4j, i just downloaded log4j1.2beta4 and was trying to figure how to use it in my application. I am building an intranet site using jsp, servlets, and beans, i want to log the error, info, and debug messages generated from java classes can anyone send me some java code which shows how log4j has been used, i would like to have the output from log4j in XML format. i read the manual and was not able to figure out how to make this thing work, also i read the documentation with same result. i really need some advice in lehman language to put this thing working ASAP Ashish __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help to configure Log4j with example
A test that I made a few minutes ago confirms this. At 16:38 11.04.2002 -0600, you wrote: I was told the apache lists filter out HTML attachments, thinking they are likely spam. Save it as a .html.txt or something, to resend. regards Adam -Original Message- From: Mark Womack [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 4:32 PM To: 'Log4J Users List' Subject: RE: Help to configure Log4j with example Maybe we should start with Dave's, edit and expand it and then submit it for future inclusion. Dave, I didn't get your html enclosure either. -Mark -Original Message- From: Gautham [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 3:29 PM To: Log4J Users List Subject: RE: Help to configure Log4j with example Oh yes! I think getting a simple User manual makes a lot of lives easier. I can still recollect the trouble I had in my initial days of Log4j usage. I hope someone adds it to the official documents list and opens it for public usage. -Original Message- From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 1:51 PM To: Log4J Users List Subject: Help to configure Log4j with example Hi, i am new to this log4j, i just downloaded log4j1.2beta4 and was trying to figure how to use it in my application. I am building an intranet site using jsp, servlets, and beans, i want to log the error, info, and debug messages generated from java classes can anyone send me some java code which shows how log4j has been used, i would like to have the output from log4j in XML format. i read the manual and was not able to figure out how to make this thing work, also i read the documentation with same result. i really need some advice in lehman language to put this thing working ASAP Ashish __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Ceki -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help to configure Log4j with example
Dave's second attempt made it through to me...I wonder what was different? -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 3:50 PM To: Log4J Users List Subject: RE: Help to configure Log4j with example A test that I made a few minutes ago confirms this. At 16:38 11.04.2002 -0600, you wrote: I was told the apache lists filter out HTML attachments, thinking they are likely spam. Save it as a .html.txt or something, to resend. regards Adam -Original Message- From: Mark Womack [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 4:32 PM To: 'Log4J Users List' Subject: RE: Help to configure Log4j with example Maybe we should start with Dave's, edit and expand it and then submit it for future inclusion. Dave, I didn't get your html enclosure either. -Mark -Original Message- From: Gautham [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 3:29 PM To: Log4J Users List Subject: RE: Help to configure Log4j with example Oh yes! I think getting a simple User manual makes a lot of lives easier. I can still recollect the trouble I had in my initial days of Log4j usage. I hope someone adds it to the official documents list and opens it for public usage. -Original Message- From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 1:51 PM To: Log4J Users List Subject: Help to configure Log4j with example Hi, i am new to this log4j, i just downloaded log4j1.2beta4 and was trying to figure how to use it in my application. I am building an intranet site using jsp, servlets, and beans, i want to log the error, info, and debug messages generated from java classes can anyone send me some java code which shows how log4j has been used, i would like to have the output from log4j in XML format. i read the manual and was not able to figure out how to make this thing work, also i read the documentation with same result. i really need some advice in lehman language to put this thing working ASAP Ashish __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Ceki -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Help with writing on File and Socket Servers
First read the manual: http://jakarta.apache.org/log4j/docs/manual.html Then read the javadocs: http://jakarta.apache.org/log4j/docs/api/index.html Pay attention to SocketAppender and any of the FileAppender subclasses (decide which to use). HTH T Master - Original Message - From: Aurioles, Jean (CORP, DDEMESIS) [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Rocha, Rogelio G (CORP, DDEMESIS) [EMAIL PROTECTED] Sent: Tuesday, February 12, 2002 9:51 AM Subject: Help with writing on File and Socket Servers Hi Log4J. I would like to know how to set the properties in order for my Apps to write to files and for Socket Servers. I do not know how to specify the Appender to take a specific file to write logs. Actually, if I could find a document or example of how to use these topics, it would be a nice to have. I hope you can help. Thanks a lot. _ Jean Paul Derek Aurioles Tapia GE Ddemesis 4605 Duke Drive 7th Floor. Mason, OH 45040 Tel: (513) 701-6860, DC:8*262-6860, Fax: (513) 701-6815 e-Mail: Jean.Aurioles @ddemesis. ge.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Help on XML config files
The property name you are looking for is log4j.configuration. Invoke your program as java -classpath `local_jars` -Dlog4j.configuration=log4j.xml -Dlog4j.debug test HTH, Ceki ps: Your XML file was never read. At 14:19 17.12.2001 -0800, you wrote: I hope I'm posting this right! I've dorked around all day trying to get an xml configuration file working. It complains about not finding a root element. The documentation on the XML configuration file is weak at best. (Only a few examples, all the same.) I want to send output to stdout and to a log file (simple enough). Below is what I get. Any help would be greatly appreciated! --Mark Here's what I get: root_ptkomni.printrak.com# java -classpath `local_jars` -Dlog4jConfigFile=log4j.xml -Dlog4j.debug test log4j: Trying to find [log4j.properties] using sun.misc.Launcher$AppClassLoader@80045e0 class loader. log4j: Using URL [jar:file:/ActiveFiles/omnitrak_server/jboss/client/jbossmq-client.jar!/log4 j.properties] for automatic log4j configuration. log4j: Reading configuration from URL jar:file:/ActiveFiles/omnitrak_server/jboss/client/jbossmq-client.jar!/log4j .properties log4j: Parsing for [root] with value=[ERROR, stdout]. log4j: Priority token is [ERROR]. log4j: Category root set to ERROR log4j: Parsing appender named stdout. log4j: Parsing layout options for stdout. log4j: Setting property [conversionPattern] to [%5p [%t] (%F:%L) - %m%n]. log4j: End of parsing for stdout. log4j: Parsed stdout options. log4j: Finished configuring. log4j: Could not find root category information. Is this OK? -- HERE'S MY PROBLEM log4j: Finished configuring. hello test() x:stuff Done. # cat 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=stdout class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d [%t] %-5p %c - %m%n/ /layout /appender appender name=A1 class=org.apache.log4j.FileAppender param name=File value=log4j.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d [%t] %-5p %c - %m%n/ /layout /appender root priority value =debug / appender-ref ref=stdout / appender-ref ref=A1 / /root /log4j:configuration -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help on XML config files
Thanks for your quick response. For the most part, I really like the log4j library. And, when I run the program with -Dlog4j.configuration=log4j.xml it does indeed work. (I was able to do this prior to the email.) However, rather than doing the log4j default initialization with -Dlog4j.configuration, I'd like to be able to specify the file to the program and call the PropertyConfigurator.configure() passing it the file name -- a system that works fine with the old style configuration files. Here's the code. Can I pass an XML file to PropertyConfigurator.configure()? Do you see something else I'm doing wrong? Thanks again, Mark import org.apache.log4j.*; import java.io.File; public class test { static Category logger = Category.getInstance(test); public test(String x) { this(); System.out.println(x: + x); } public test() { System.out.println(test()); } public static void main(String args[]) { // Initialize Log4J. String logConfig = null; String log4jConfigFile = System.getProperty(log4jConfigFile, log4j.config); if (new File(log4jConfigFile).exists()) { PropertyConfigurator.configure(log4jConfigFile); -- HERE'S THE CALL TO CONFIGURE } else { // No configuration file. Set it up manually. PatternLayout pl = new PatternLayout(%d [%t] %-5p %c - %m%n); ConsoleAppender ca = new ConsoleAppender(pl); BasicConfigurator.configure(ca); logger.setPriority(org.apache.log4j.Priority.DEBUG); logger.warn(Log4j configuration file \ + log4jConfigFile + \ not found. Using BasicConfigurator.); } logger.debug(main); System.out.println(hello); test t = new test(stuff); System.out.println(Done.); } } -Original Message- From: Ceki Gulcu [mailto:[EMAIL PROTECTED]] Sent: Monday, December 17, 2001 2:59 PM To: Log4J Users List Subject: Re: Help on XML config files The property name you are looking for is log4j.configuration. Invoke your program as java -classpath `local_jars` -Dlog4j.configuration=log4j.xml -Dlog4j.debug test HTH, Ceki ps: Your XML file was never read. At 14:19 17.12.2001 -0800, you wrote: I hope I'm posting this right! I've dorked around all day trying to get an xml configuration file working. It complains about not finding a root element. The documentation on the XML configuration file is weak at best. (Only a few examples, all the same.) I want to send output to stdout and to a log file (simple enough). Below is what I get. Any help would be greatly appreciated! --Mark Here's what I get: root_ptkomni.printrak.com# java -classpath `local_jars` -Dlog4jConfigFile=log4j.xml -Dlog4j.debug test log4j: Trying to find [log4j.properties] using sun.misc.Launcher$AppClassLoader@80045e0 class loader. log4j: Using URL [jar:file:/ActiveFiles/omnitrak_server/jboss/client/jbossmq-client.jar!/log 4 j.properties] for automatic log4j configuration. log4j: Reading configuration from URL jar:file:/ActiveFiles/omnitrak_server/jboss/client/jbossmq-client.jar!/log4 j .properties log4j: Parsing for [root] with value=[ERROR, stdout]. log4j: Priority token is [ERROR]. log4j: Category root set to ERROR log4j: Parsing appender named stdout. log4j: Parsing layout options for stdout. log4j: Setting property [conversionPattern] to [%5p [%t] (%F:%L) - %m%n]. log4j: End of parsing for stdout. log4j: Parsed stdout options. log4j: Finished configuring. log4j: Could not find root category information. Is this OK? -- HERE'S MY PROBLEM log4j: Finished configuring. hello test() x:stuff Done. # cat 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=stdout class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d [%t] %-5p %c - %m%n/ /layout /appender appender name=A1 class=org.apache.log4j.FileAppender param name=File value=log4j.log/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d [%t] %-5p %c - %m%n/ /layout /appender root priority value =debug / appender-ref ref=stdout / appender-ref ref=A1 / /root /log4j:configuration -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e
Re: Help Needed!
Hi Mark, I am using the FileWatchdog and PropertyConfigurator as suggested by u. But I am not able to fix the puzzle. What I have now is individual parts and need your advice on placing things together. I want to use RollingFileAppender with run-time configuration of the debug, errors and info messages (each type having a file). Now how to invoke the PropertyConfigurator class as well as the classes extended from FileWatchdog and PropertyConfigurator ? Also how to load the log4j config file? We are using WeblogicServer6.0sp1 running 2 webapps. We need to log messages of this webapps to seperatelly and in three seperate files debug, errors and info respectively . Can u give me soem pointers and if possible sample code ? Thanx in advance CIAOAjay From: Mark Masterson Subject: RE: modifying log levels through a management console Date: Tue, 05 Jun 2001 08:16:39 -0700 You don't need to jump through this many hoops to get this behavior - there is an easier way to achieve dynamic, run-time re-configuration using standard config files. Specifically, you don't need to roll your own file listener - Log4J already has one. To do this, you subclass FileWatchdog and the appropriate PropertyConfigurator. For example, in our apps, we subclass FileWatchdog and DOMConfigurator. Then, you override doOnChange() and configureAndWatch(), in your FileWatchdog sub-class and your PropertyConfigurator sub-class, respectively. In the PropertyConfigurator sub-class's configureAndWatch() method, you set things up to use your FileWatchdog sub-class (instead of a standard one), and in the doOnChange() method of your FileWatchdog class, you call BasicConfigurator.resetConfiguration(). In your application, you then need to initialize Log4J by using your PropertyConfigurator class instead of the standard one, i.e.; "M2TraceDomConfigurator.configureAndWatch(configFile,configReloadDelay);" and not "DOMConfigurator.configureAndWatch(configFile,configReloadDelay);". Below are code snippets for the relevant spots from the implementation we're using here - works fine. This question has already been answered at least once on this list, primarily by Ceki and Jim Moore - you should check the list archives for more details. Cheers, Mark public class M2TracePropertyWatchdog extends FileWatchdog{ blah, blah, blah public void doOnChange() { BasicConfigurator.resetConfiguration(); new DOMConfigurator().doConfigure(filename, Category.getDefaultHierarchy()); } blah, blah, blah } public class M2TraceDomConfigurator extends DOMConfigurator { blah, blah, blah public static void configureAndWatch(String configFilename, long delay) { M2TracePropertyWatchdog pDog = new M2TracePropertyWatchdog(configFilename); pDog.setDelay(delay); pDog.start(); } blah, blah, blah } Keep the Faith! Good Happens!! From: "Mark Masterson" <[EMAIL PROTECTED]> Reply-To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]> To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]> Subject: SNMP appender? Date: Thu, 27 Sep 2001 20:47:56 +0200 Anybody have an appender that emits SNMP messages? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Get your FREE download of MSN Explorer at http://explorer.msn.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help needed on propertyConfigurator
viswa wrote: Hi all, I am looking in to the log4j manual.In the following example where is he specifing the configuration file. Even in many examples i saw PropertyConfigurator.configure(args[0]). But i haven't seen the file name and location of it. Can anybody tell Where is he specifing the location of the file. import com.foo.Bar; import org.apache.log4j.Category; import org.apache.log4j.PropertyConfigurator; public class MyApp { static Category cat = Category.getInstance(MyApp.class.getName()); public static void main(String[] args) { // BasicConfigurator replaced with PropertyConfigurator. PropertyConfigurator.configure(args[0]); cat.info(Entering application.); Bar bar = new Bar(); bar.doIt(); cat.info(Exiting application.); } } args[0] refers to the first command line parameter given to your application. So if your application is 'MyAapp' and configuration info is in 'MyApp.config' then you would bring up the app with java MyApp MyApp.config Cheers Claus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help needed to configureAndWatch method
You want watch it roughly 30 times a second? That parameter is in miliseconds. Try setting it to 3000 for every 3 seconds. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 04, 2001 2:39 PM To: [EMAIL PROTECTED] Subject: Help needed to configureAndWatch method Hi I am trying to run following code. It does's not run , it is stuck on number 30 rather it hangs. I don't understand what mistake i am making. String logPropertiesFile = /log.properties; PropertyConfigurator.configureAndWatch(logPropertiesFile,30); I have log.properties in my c drive. Thanks Giri - 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: Help with log4j and cactus
Shawn, Try the following XML file. ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration appender name=TEMP1 class=org.apache.log4j.FileAppender param name=file value=c:/temp/appserver.log/ param name=append value=true/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{ISO8601} [%t] %-5p %c %x - %m%n/ /layout /appender appender name=STDOUT class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{ISO8601} [%t] %-5p %c %x - %m%n/ /layout /appender root priority value=debug/ appender-ref ref=TEMP1/ /root /log4j:configuration Categories inherit their priority and appenders. You do not need to define them explicitly. For example, this category element category name=com.divine additivity=true priority value=debug/ appender-ref ref=TEMP1/ /category is superfluous. It will actually cause the TEMP1 appender to be used multiple times. I also suggest that you read the section on appender additivity in the log4j manual. Hope this helps, Ceki At 18:56 24.07.2001 -0500, Storoe, Shawn wrote: Here is my configuration file. I believe that the answer to that question is Yes, based on the context. But why would this affect cactus? Thanks for responding so quickly. I really appreciate it. ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration appender name=TEMP1 class=org.apache.log4j.FileAppender param name=file value=c:/temp/appserver.log/ param name=append value=true/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{ISO8601} [%t] %-5p %c %x - %m%n/ /layout /appender appender name=STDOUT class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{ISO8601} [%t] %-5p %c %x - %m%n/ /layout /appender category name=com.divine additivity=true priority value=debug/ appender-ref ref=TEMP1/ /category category name=com.divine.engine.util additivity=true priority value=debug/ appender-ref ref=TEMP1/ /category category name=com.divine.core.properties additivity=true priority value=debug/ appender-ref ref=TEMP1/ /category category name=com.divine.engine.transform additivity=true priority value=debug/ appender-ref ref=TEMP1/ /category category name=com.divine.engine.router additivity=true priority value=debug/ appender-ref ref=TEMP1/ /category category name=com.divine.engine.registry additivity=true priority value=debug/ appender-ref ref=TEMP1/ /category category name=com.divine.engine.aggregate additivity=true priority value=debug/ appender-ref ref=TEMP1/ /category category name=com.divine.engine.service additivity=true priority value=debug/ appender-ref ref=TEMP1/ /category root priority value=debug/ appender-ref ref=TEMP1/ /root /log4j:configuration -Original Message- From: Ceki Gülcü Sent: Tue 7/24/2001 5:29 PM To: LOG4J Users Mailing List Cc: Subject: Re: Help with log4j and cactus Does your configuration file mention TEMP1 in multiple categories? Ceki At 17:10 24.07.2001 -0500, Storoe, Shawn wrote: I am currently working on a project that is using the following products. Bluestone application server. Ant Scripts to run cactus and junit tests. Up to this point, I have not had any problem logging from out application. However once I started extending ServletTestCase instead of TestCase, I started to get errors as follows from both the ant scripts and the Bluestone server console. I have searched everywhere on the web and cannot find any pointers or hints to get around this problem. Does anyone have any ideas? Ant Scripts: [junit] log4j:WARN Not allowed to write to a closed appender. [junit] log4j:ERROR Attempted to append to closed appender named [TEMP1]. [junit] log4j:WARN Not allowed to write to a closed appender. [junit] log4j:ERROR Attempted to append to closed appender named [TEMP1]. [junit] log4j:WARN Not allowed to write to a closed appender. [junit] log4j:ERROR Attempted to append to closed appender named [TEMP1]. [junit] log4j:WARN Not allowed to write to a closed appender. [junit] log4j:ERROR Attempted to append to closed appender named [TEMP1]. [junit] log4j:WARN Not allowed to write to a closed appender. [junit] log4j:ERROR Attempted to append to closed appender named [TEMP1]. [junit] log4j:WARN Not allowed to write to a closed appender. [junit] log4j:ERROR
Re: Help with log4j and cactus
Does your configuration file mention TEMP1 in multiple categories? Ceki At 17:10 24.07.2001 -0500, Storoe, Shawn wrote: I am currently working on a project that is using the following products. Bluestone application server. Ant Scripts to run cactus and junit tests. Up to this point, I have not had any problem logging from out application. However once I started extending ServletTestCase instead of TestCase, I started to get errors as follows from both the ant scripts and the Bluestone server console. I have searched everywhere on the web and cannot find any pointers or hints to get around this problem. Does anyone have any ideas? Ant Scripts: [junit] log4j:WARN Not allowed to write to a closed appender. [junit] log4j:ERROR Attempted to append to closed appender named [TEMP1]. [junit] log4j:WARN Not allowed to write to a closed appender. [junit] log4j:ERROR Attempted to append to closed appender named [TEMP1]. [junit] log4j:WARN Not allowed to write to a closed appender. [junit] log4j:ERROR Attempted to append to closed appender named [TEMP1]. [junit] log4j:WARN Not allowed to write to a closed appender. [junit] log4j:ERROR Attempted to append to closed appender named [TEMP1]. [junit] log4j:WARN Not allowed to write to a closed appender. [junit] log4j:ERROR Attempted to append to closed appender named [TEMP1]. [junit] log4j:WARN Not allowed to write to a closed appender. [junit] log4j:ERROR Attempted to append to closed appender named [TEMP1]. [junit] log4j:WARN Not allowed to write to a closed appender. [junit] log4j:ERROR Attempted to append to closed appender named [TEMP1]. [junit] log4j:WARN Not allowed to write to a closed appender. [junit] log4j:ERROR Attempted to append to closed appender named [TEMP1]. Bluestone server console. log4j:WARN Not allowed to write to a closed appender. log4j:ERROR Attempted to append to closed appender named [TEMP]. log4j:WARN Not allowed to write to a closed appender. log4j:ERROR Attempted to append to closed appender named [TEMP]. log4j:WARN Not allowed to write to a closed appender. log4j:ERROR Attempted to append to closed appender named [TEMP]. log4j:WARN Not allowed to write to a closed appender. log4j:ERROR Attempted to append to closed appender named [TEMP]. log4j:WARN Not allowed to write to a closed appender. log4j:ERROR Attempted to append to closed appender named [TEMP]. All of the log4j logging appears to work fine if I am not in the ServletTestCase? Thanks Shawn Storoe es -- Ceki Gülcü - http://qos.ch - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help: DOMConfigurator, Custom Categories XML Config Files
Jay Riddell wrote: My question is: How do I set this in an XML config file ? The DTD seems to say nothing about Factories. Hi Jay, It does now. Thanks for the patience. Also, refresh your appserver package and run javadoc on it. There's an example of how to configure a category factory subclass using DOMConfigurator. - Paul -- Beware of bugs in the above code. I have only proved it correct, not tried it. -Don Knuth - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help needed : Log4J with servlets
The problem is that Category takes a String, not a class. Category cat = Category.getInstance(NameOfTheServlet.class.getName()); If you turn off friendly error messages in IE, you would have been able to see this error. Scott [EMAIL PROTECTED] 06/13/01 01:15pm Hi, I'm trying to use log4J with servlets (running on weblogic) When I try to create a category instance inside my servlet, -- Category cat = Category.getInstance(NameOfTheServlet.class); -- This causes internal server error. What exactly could be the problem? I've imported the following packages in my servlet: -- import org.apache.log4j.xml.DOMConfigurator; import org.apache.log4j.Category; import org.apache.log4j.Priority; -- The java file compiles without any warnings or errors but the servlet during runtime gives 'Internal server error'. I would really appreciate a sample code that illustrates the usage of log4J with servlets. Thanks regards, Amit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- This message has been scanned by MailSweeper. --- --- This e-mail is solely for the use of the intended recepient and may contain information which is confidential or privileged. Unauthorised use of its contents is prohibited. If you have received this e-mail in error, please notify the sender immediately via e-mail and then delete the original e-mail. --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help needed : Log4J with servlets
Amit, What's error being generated? Ceki At 14:22 13.06.2001 +0530, you wrote: Hi, If following code is valid Category cat = Category.getInstance(NameOfTheServlet.class.getName()); then, could you please give me an example of how to use Log4J with servlets? I need to use XML file as configuration file which should be parsed thru' servlet and necessary logging should be done. Currently I've used the following code (inside doPost method): --- static Category cat = Category.getInstance(assign4Servlet.class.getName()); try { URL url = getServletConfig().getServletContext().getResource(/sample1.xml); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(url.toExternalForm()); DOMConfigurator.configure(doc.getDocumentElement()); -- some servlet code -- cat.info(Inside doPost method of the servlet); cat.debug(Inside doPost method of the servlet); } catch(ParserConfigurationException eP) { } catch(SAXException eS) { } file sample1.xml is in the same directory as the servlet class file. But there is no log being generated. What could be the problem? Thanks regards, Amit Amit Vaidya Infosys® Pune, India Tel : 91-2139-32801 (outside Pune) 95-2139-32801 (from Pune) Ext : 4342 -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 2:20 PM To: LOG4J Users Mailing List; [EMAIL PROTECTED] Subject: Re: Help needed : Log4J with servlets At 17:30 13.06.2001 +1000, SCOTT FARQUHAR wrote: The problem is that Category takes a String, not a class. Hello Scott, Categoty.getInstance takes a string or a class. Assuming that the MyFooBar class is in the ch.qos package. The following a strictly equivalent: Category x = Category.getInstance(ch.qos.MyFooBar); Category x = Category.getInstance(MyFooBar.class.getName()); Category x = Category.getInstance(MyFooBar.class); Category cat = Category.getInstance(NameOfTheServlet.class.getName()); If you turn off friendly error messages in IE, you would have been able to see this error. Scott [EMAIL PROTECTED] 06/13/01 01:15pm Hi, I'm trying to use log4J with servlets (running on weblogic) When I try to create a category instance inside my servlet, -- Category cat = Category.getInstance(NameOfTheServlet.class); -- This causes internal server error. What exactly could be the problem? I've imported the following packages in my servlet: -- import org.apache.log4j.xml.DOMConfigurator; import org.apache.log4j.Category; import org.apache.log4j.Priority; -- The java file compiles without any warnings or errors but the servlet during runtime gives 'Internal server error'. I would really appreciate a sample code that illustrates the usage of log4J with servlets. Thanks regards, Amit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help needed : Log4J with servlets
I want to log the messages into a file 'logfile.txt'. The name of this file other setting are present in 'sample1.xml' The java program compiles (into servlet) without any error. There is no error in the execution of the servlet. But log log is being generated. Even the file logfile.txt is not being created. Please help. Thanks, Amit Amit Vaidya Infosys® Pune, India Tel : 91-2139-32801 (outside Pune) 95-2139-32801 (from Pune) Ext : 4342 -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 2:37 PM To: LOG4J Users Mailing List Subject: RE: Help needed : Log4J with servlets Amit, What's error being generated? Ceki At 14:22 13.06.2001 +0530, you wrote: Hi, If following code is valid Category cat = Category.getInstance(NameOfTheServlet.class.getName()); then, could you please give me an example of how to use Log4J with servlets? I need to use XML file as configuration file which should be parsed thru' servlet and necessary logging should be done. Currently I've used the following code (inside doPost method): --- static Category cat = Category.getInstance(assign4Servlet.class.getName()); try { URL url = getServletConfig().getServletContext().getResource(/sample1.xml); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(url.toExternalForm()); DOMConfigurator.configure(doc.getDocumentElement()); -- some servlet code -- cat.info(Inside doPost method of the servlet); cat.debug(Inside doPost method of the servlet); } catch(ParserConfigurationException eP) { } catch(SAXException eS) { } file sample1.xml is in the same directory as the servlet class file. But there is no log being generated. What could be the problem? Thanks regards, Amit ___ _ Amit Vaidya Infosys® Pune, India Tel : 91-2139-32801 (outside Pune) 95-2139-32801 (from Pune) Ext : 4342 -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 2:20 PM To: LOG4J Users Mailing List; [EMAIL PROTECTED] Subject: Re: Help needed : Log4J with servlets At 17:30 13.06.2001 +1000, SCOTT FARQUHAR wrote: The problem is that Category takes a String, not a class. Hello Scott, Categoty.getInstance takes a string or a class. Assuming that the MyFooBar class is in the ch.qos package. The following a strictly equivalent: Category x = Category.getInstance(ch.qos.MyFooBar); Category x = Category.getInstance(MyFooBar.class.getName()); Category x = Category.getInstance(MyFooBar.class); Category cat = Category.getInstance(NameOfTheServlet.class.getName()); If you turn off friendly error messages in IE, you would have been able to see this error. Scott [EMAIL PROTECTED] 06/13/01 01:15pm Hi, I'm trying to use log4J with servlets (running on weblogic) When I try to create a category instance inside my servlet, -- Category cat = Category.getInstance(NameOfTheServlet.class); -- This causes internal server error. What exactly could be the problem? I've imported the following packages in my servlet: -- import org.apache.log4j.xml.DOMConfigurator; import org.apache.log4j.Category; import org.apache.log4j.Priority; -- The java file compiles without any warnings or errors but the servlet during runtime gives 'Internal server error'. I would really appreciate a sample code that illustrates the usage of log4J with servlets. Thanks regards, Amit - 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: Help needed : Log4J with servlets
Hi, I'm using following XML file for configuring Log4J (thru' servlets) - ?xml version=1.0 encoding=UTF-8? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration appender name=STDOUT class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%5p [%t] (%F:%L) - %m%n/ /layout /appender appender name=LogFile class=org.apache.log4j.RollingFileAppender param name=File value=logFile.txt/ param name=MaxFileSize value=100KB/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%p %t %c - %m%n/ /layout /appender category name=assign4Servlet appender-ref ref=STDOUT/ appender-ref ref=LogFile/ priority value=DEBUG/ /category root priority value=DEBUG/ /root /log4j:configuration - The name of my servlet is 'assign4Servlet'. When the servlet is executed, I get the following error message: = log4j:ERROR No appenders could be found for category (assign4Servlet). log4j:ERROR Please initialize the log4j system properly. = Why am I getting this message inspite of having specified 2 appenders to category 'assign4Servlet' Regards, Amit Amit Vaidya Infosys® Pune, India Tel : 91-2139-32801 (outside Pune) 95-2139-32801 (from Pune) Ext : 4342 -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 2:37 PM To: LOG4J Users Mailing List Subject: RE: Help needed : Log4J with servlets Amit, What's error being generated? Ceki At 14:22 13.06.2001 +0530, you wrote: Hi, If following code is valid Category cat = Category.getInstance(NameOfTheServlet.class.getName()); then, could you please give me an example of how to use Log4J with servlets? I need to use XML file as configuration file which should be parsed thru' servlet and necessary logging should be done. Currently I've used the following code (inside doPost method): --- static Category cat = Category.getInstance(assign4Servlet.class.getName()); try { URL url = getServletConfig().getServletContext().getResource(/sample1.xml); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(url.toExternalForm()); DOMConfigurator.configure(doc.getDocumentElement()); -- some servlet code -- cat.info(Inside doPost method of the servlet); cat.debug(Inside doPost method of the servlet); } catch(ParserConfigurationException eP) { } catch(SAXException eS) { } file sample1.xml is in the same directory as the servlet class file. But there is no log being generated. What could be the problem? Thanks regards, Amit ___ _ Amit Vaidya Infosys® Pune, India Tel : 91-2139-32801 (outside Pune) 95-2139-32801 (from Pune) Ext : 4342 -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 2:20 PM To: LOG4J Users Mailing List; [EMAIL PROTECTED] Subject: Re: Help needed : Log4J with servlets At 17:30 13.06.2001 +1000, SCOTT FARQUHAR wrote: The problem is that Category takes a String, not a class. Hello Scott, Categoty.getInstance takes a string or a class. Assuming that the MyFooBar class is in the ch.qos package. The following a strictly equivalent: Category x = Category.getInstance(ch.qos.MyFooBar); Category x = Category.getInstance(MyFooBar.class.getName()); Category x = Category.getInstance(MyFooBar.class); Category cat = Category.getInstance(NameOfTheServlet.class.getName()); If you turn off friendly error messages in IE, you would have been able to see this error. Scott [EMAIL PROTECTED] 06/13/01 01:15pm Hi, I'm trying to use log4J with servlets (running on weblogic) When I try to create a category instance inside my servlet, -- Category cat = Category.getInstance(NameOfTheServlet.class); -- This causes internal server error. What exactly could be the problem? I've imported the following packages in my servlet: -- import org.apache.log4j.xml.DOMConfigurator; import org.apache.log4j.Category; import
Re: Help needed : Log4J with servlets
Amit, Here is some sample code of how we have used Log4J in servlets. public class StartupServlet extends HttpServlet { static Category cat = Category.getInstance(StartupServlet.class.getName()); public void init() { URL propsURL = Util.configureLog4j(); PropertyConfigurator.configure(propsURL); cat.info( Starting the app); } ... } //here is the Util class public class Util { public static URL configureLog4j() { ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL propertiesURL = loader.getResource(log4j.properties); return propertiesURL; } } Thanks Zeba Amit Vaidya wrote: Hi, If following code is valid Category cat = Category.getInstance(NameOfTheServlet.class.getName()); then, could you please give me an example of how to use Log4J with servlets? I need to use XML file as configuration file which should be parsed thru' servlet and necessary logging should be done. Currently I've used the following code (inside doPost method): --- static Category cat = Category.getInstance(assign4Servlet.class.getName()); try { URL url = getServletConfig().getServletContext().getResource(/sample1.xml); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(url.toExternalForm()); DOMConfigurator.configure(doc.getDocumentElement()); -- some servlet code -- cat.info(Inside doPost method of the servlet); cat.debug(Inside doPost method of the servlet); } catch(ParserConfigurationException eP) { } catch(SAXException eS) { } file sample1.xml is in the same directory as the servlet class file. But there is no log being generated. What could be the problem? Thanks regards, Amit Amit Vaidya Infosys® Pune, India Tel : 91-2139-32801 (outside Pune) 95-2139-32801 (from Pune) Ext : 4342 -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 2:20 PM To: LOG4J Users Mailing List; [EMAIL PROTECTED] Subject: Re: Help needed : Log4J with servlets At 17:30 13.06.2001 +1000, SCOTT FARQUHAR wrote: The problem is that Category takes a String, not a class. Hello Scott, Categoty.getInstance takes a string or a class. Assuming that the MyFooBar class is in the ch.qos package. The following a strictly equivalent: Category x = Category.getInstance(ch.qos.MyFooBar); Category x = Category.getInstance(MyFooBar.class.getName()); Category x = Category.getInstance(MyFooBar.class); Category cat = Category.getInstance(NameOfTheServlet.class.getName()); If you turn off friendly error messages in IE, you would have been able to see this error. Scott [EMAIL PROTECTED] 06/13/01 01:15pm Hi, I'm trying to use log4J with servlets (running on weblogic) When I try to create a category instance inside my servlet, -- Category cat = Category.getInstance(NameOfTheServlet.class); -- This causes internal server error. What exactly could be the problem? I've imported the following packages in my servlet: -- import org.apache.log4j.xml.DOMConfigurator; import org.apache.log4j.Category; import org.apache.log4j.Priority; -- The java file compiles without any warnings or errors but the servlet during runtime gives 'Internal server error'. I would really appreciate a sample code that illustrates the usage of log4J with servlets. Thanks regards, Amit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- This message has been scanned by MailSweeper. --- --- This e-mail is solely for the use of the intended recepient and may contain information which is confidential or privileged. Unauthorised use of its contents is prohibited. If you have received this e-mail in error, please notify the sender immediately via e-mail and then delete the original e-mail. --- - To unsubscribe, e
Re: Help needed : Log4J with servlets
Sorry about that. My mistake. [EMAIL PROTECTED] 06/13/01 06:50pm At 17:30 13.06.2001 +1000, SCOTT FARQUHAR wrote: The problem is that Category takes a String, not a class. Hello Scott, Categoty.getInstance takes a string or a class. Assuming that the MyFooBar class is in the ch.qos package. The following a strictly equivalent: Category x = Category.getInstance(ch.qos.MyFooBar); Category x = Category.getInstance(MyFooBar.class.getName()); Category x = Category.getInstance(MyFooBar.class); Category cat = Category.getInstance(NameOfTheServlet.class.getName()); If you turn off friendly error messages in IE, you would have been able to see this error. Scott [EMAIL PROTECTED] 06/13/01 01:15pm Hi, I'm trying to use log4J with servlets (running on weblogic) When I try to create a category instance inside my servlet, -- Category cat = Category.getInstance(NameOfTheServlet.class); -- This causes internal server error. What exactly could be the problem? I've imported the following packages in my servlet: -- import org.apache.log4j.xml.DOMConfigurator; import org.apache.log4j.Category; import org.apache.log4j.Priority; -- The java file compiles without any warnings or errors but the servlet during runtime gives 'Internal server error'. I would really appreciate a sample code that illustrates the usage of log4J with servlets. Thanks regards, Amit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- This message has been scanned by MailSweeper. --- --- This e-mail is solely for the use of the intended recepient and may contain information which is confidential or privileged. Unauthorised use of its contents is prohibited. If you have received this e-mail in error, please notify the sender immediately via e-mail and then delete the original e-mail. --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki Gülcü - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- This message has been scanned by MailSweeper. --- --- This e-mail is solely for the use of the intended recepient and may contain information which is confidential or privileged. Unauthorised use of its contents is prohibited. If you have received this e-mail in error, please notify the sender immediately via e-mail and then delete the original e-mail. --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [HELP] Problem with custom Category
Giovanni Giorgi wrote: AppServerCategory.getInstance() returns a Category instance *instead* of the preferred AppServerCategory. It seems some beans force the configurtion of Log4J, but I re-configure it before getting my instance! Why so?! I haven't understand the reason! Please help me! Hi Giovanni, This is indeed a problem that I'm working to correct. It is not the fault of WebLogic. The present work around is described in the package documentation for the org.apache.log4j.examples.appserver. The above doc doesn't explain why reconfiguration doesn't solve it. Reconfiguration only removes. It leaves the categories in tact. So there is no opportunity to create new catagories. The getInstance method will always return the one that existed before (with possibly different appenders configured). - Paul -- Beware of bugs in the above code. I have only proved it correct, not tried it. -Don Knuth - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [HELP] Problem with custom Category
Paul Glezen wrote: Giovanni Giorgi wrote: AppServerCategory.getInstance() returns a Category instance *instead* of the preferred AppServerCategory. It seems some beans force the configurtion of Log4J, but I re-configure it before getting my instance! Why so?! I haven't understand the reason! Please help me! Hi Giovanni, This is indeed a problem that I'm working to correct. It is not the fault of WebLogic. The present work around is described in the package documentation for the org.apache.log4j.examples.appserver. The above doc doesn't explain why reconfiguration doesn't solve it. Reconfiguration only removes. It leaves the categories in tact. So there is no opportunity to create new catagories. The getInstance method will always return the one that existed before (with possibly different appenders configured). Sorry I botched the above explanation. The second line in the last paragraph should have read: Resetting the configuration only removes Appenders, leaving categories in tact. Subsequent re-configurations to not re-create categories previously existing categories. Only new categories will exist. - Paul -- Beware of bugs in the above code. I have only proved it correct, not tried it. -Don Knuth - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [HELP] Urgent help on log4j Appenders being nullified
At 15:30 24.05.2001 +0100, you wrote: ok, found the problem. apparently one of my server container classes had a finalize method defined, that called shutdown on its category, which shutdwon all the appenders in that hierarchy. so now i jhust need to find why its gc'ing the server container object (for no rightful reason). That's a definite bug in the server container code! In Java any instance of a class can invoke a static method of its class. In particular, any org.apache.log4j.Category instance can invoke the shutdown (static) method of the Category class. However, shutdown acts on the whole category hierarchy which is probably not what you want. Regards, Ceki interesting lesson of pulling hair out for an afternon though. -Original Message- From: John Waugh [mailto:[EMAIL PROTECTED]mailto:[EMAIL PROTECTED]] Sent: 24 May 2001 14:09 To: Log4j-User (E-mail) Subject: [HELP] Urgent help on log4j Appenders being nullified As I've said in my previous mails (to little avail) I keep getting complaints from log4j about the fact that there are no appenders on my categories, so I wrote a couple of functions that will take a category and search the hierarchy for appenders, if they find one, they will add it to this category, so it has an appender (so I should get no complaints!!). did that, still got complaints. so I opened up log4j and looked at the src. in the cateogry.callAppenders fn, the point where the complaint was comping from it turns out writes was 0, meaning it had checked the hierarchy for parent etc... category appenders (as near as makes no difference for the sake of this arg), found none, so hadn't written the log to any log files. now the interesting part. It seems every time i run my program the complaint comes from logging in one of two threads. not necessarily the same one each time i run the program. so, i write out the memory addresses of the category being made, the appenders added to it, and the categories and appenders being checked when it calls callAppenders. It turns out that although when created the categories in both threads have valid references, and appenders with valid references added to them, after the complinat (which happens early on in the program life) one of the threads categrories has the same references (hardly expected to change) but now the appenders are all null. I never set them to null, so any idea why this happens? -- Ceki Gülcü - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help on property file settings for Appenders and Layouts
Maybe it would be useful for us to have a convention of listing all configurable properties of components in the class-level javadoc comment. For each property there'd be the name and a link to the associated setter method. I s'pose not all setters are necessarily intended for configuration. Anders Ceki Gülcü wrote: At 13:27 24.05.2001 +0100, you wrote: Hi all, I'm just trialing Log4J as a new logging solution for our system and I'm trying to configure the appenders and layouts by property file. Is there any documentation of the possible property settings for each of the Log4J classes (e.g DailyRollingFileAppender and HTMLLayout). Looking through the exxamples they show a few of the settings but not all of them, where would I find the rest? regards, Mike Hurd This is a new FAQ entry: What are the configurable options for FooBarAppender? Log4j uses JavaBeans style configuration. Thus, any setter method in FooBarAppender corresponds to a configurable option. For example, in RollingFileAppender the setMaxBackupIndex(int maxBackups) method corresponds to the maxBackupIndex option. The first letter of the option can be upper case, i.e. MaxBackupIndex and maxBackupIndex are equivalent but not MAXBACKUPIndex nor mAXBackupIndex. Layouts options are also defined by their setter methods. Same goes for most other log4j components. Hope this answers the question. Ceki - 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: [HELP] Urgent help on log4j Appenders being nullified
Sounds weird. Have you tried running with the log4j.configDebug variable defined (java -Dlog4j.configDebug ...)? It might give some idea. Otherwise it would be useful if you could reproduce the problem in a small test program or something and send it to the list. Cheers, Anders John Waugh wrote: As I've said in my previous mails (to little avail) I keep getting complaints from log4j about the fact that there are no appenders on my categories, so I wrote a couple of functions that will take a category and search the hierarchy for appenders, if they find one, they will add it to this category, so it has an appender (so I should get no complaints!!). did that, still got complaints. so I opened up log4j and looked at the src. in the cateogry.callAppenders fn, the point where the complaint was comping from it turns out writes was 0, meaning it had checked the hierarchy for parent etc... category appenders (as near as makes no difference for the sake of this arg), found none, so hadn't written the log to any log files. now the interesting part. It seems every time i run my program the complaint comes from logging in one of two threads. not necessarily the same one each time i run the program. so, i write out the memory addresses of the category being made, the appenders added to it, and the categories and appenders being checked when it calls callAppenders. It turns out that although when created the categories in both threads have valid references, and appenders with valid references added to them, after the complinat (which happens early on in the program life) one of the threads categrories has the same references (hardly expected to change) but now the appenders are all null. I never set them to null, so any idea why this happens? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [HELP] Searching for a client-server log engine
Dear Scott, would it be possible to receive your servlet code? Thilo -Original Message- From: L. Scott Emmons [mailto:[EMAIL PROTECTED]] Sent: Mittwoch, 2. Mai 2001 18:14 To: LOG4J Users Mailing List Subject: Re: [HELP] Searching for a client-server log engine Giovanni Giorgi wrote: Ciao! I am searching a good log engine/library for Java, [...] I am searching a tool with a robust server-side font-end for logging more servers on four hosts. I'd like to have a single log server for collecting all the logs and browse them. [...] I think Log4j is more simple to extend, it is right? If JMS is a possibility for you, it makes an excellent way to build a logging framework. log4j supports it out of the box, which is nice. What I did for our environment (J2EE based) is build some simple wrappers around log4j (handling things like configuration) for the producer end, and using log4j to send everything to a JMS Topic. One or more message receivers then subscribes to the Topic and handles the messages. In our case, I built one receiver (somewhat like the JMSSink example code) which sends messages to a file. Another runs in a servlet allowing access to the last 500 log messages via a browser. JMS makes a pretty flexible framework to do this sort of thing. Good luck, -Scott - 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: help with Wrapping/Buffering
Hi Scott, I'm not sure you completely understood my problem (or perhaps I didn't understand your answer!) I'll try to restate the issue again. In order to avoid having huge log files full of unneeded information, I am going to store the log items for a session in a buffer. The items in this buffer may be discarded if there are no problems, but if there is an error, I'd like to output the contents of the buffer to a file. My problem is that if I handle the buffering before even touching log4j, then later pass the contents of the buffer through log4j I will not be able to retrospectively work out %F,%L etc. My plan was to find this information and add it to the buffer myself. After sleeping on the problem, I have thought of a second possibility, and would be interested to hear if anything like this has been done before: I was thinking about having some sort of BufferAppender which could add the LoggingEvents to an array/vector then some trigger could be used to output this information to a file when necessary. One downside I can see with this is that if I've specified the BufferAppender as the appender for a category, I will lose the ability to specify where the information is passed after the buffer. Well, I've successfully managed to confuse myself. If anyone understands my problem, and can suggest a solution then please let me know. Thanks, Ross -- From: "SCOTT FARQUHAR" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: help with Wrapping/Buffering Date: Wed, 11 Apr 2001 09:40:13 +1000 Wouldn't it be better to write your own Configurator to turn log4j logging on and off when necessary? Surely you could write it so that it would cater for whatever business logic you need.. /speculating Scott [EMAIL PROTECTED] 04/10/01 08:19pm Hi there, I've just started using log4j (and am still a newbie to java itself).I am using a wrapper class around log4j, and part of what my wrapper does is to buffer log items, only sending them to log4j when certain events occur. Clearly by doing this, I lose log4j's ability to automatically retrieve methods, line numbers etc. from the caller. It seems like what I have to do is to retrieve this information before I add an individual log to the buffer, then send it as part of the message string to log4j. Obviously I would lose some flexibility in the PatternLayout function, but this is not crucial. I understand that log4j somehow gets this information from a stack trace, but I am unsure of exactly how this works, or how I would go about getting the information for myself. Thanks in advance for any help, Ross Ovland - 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]
RE: help with Wrapping/Buffering
Take a look at SMTPAppender. It uses a cyclic buffer and trigger event to flush. It sends email, but it should be easy to modify that. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 11, 2001 4:24 AM To: [EMAIL PROTECTED] Subject: Re: help with Wrapping/Buffering Hi Scott, I'm not sure you completely understood my problem (or perhaps I didn't understand your answer!) I'll try to restate the issue again. In order to avoid having huge log files full of unneeded information, I am going to store the log items for a session in a buffer. The items in this buffer may be discarded if there are no problems, but if there is an error, I'd like to output the contents of the buffer to a file. My problem is that if I handle the buffering before even touching log4j, then later pass the contents of the buffer through log4j I will not be able to retrospectively work out %F,%L etc. My plan was to find this information and add it to the buffer myself. After sleeping on the problem, I have thought of a second possibility, and would be interested to hear if anything like this has been done before: I was thinking about having some sort of BufferAppender which could add the LoggingEvents to an array/vector then some trigger could be used to output this information to a file when necessary. One downside I can see with this is that if I've specified the BufferAppender as the appender for a category, I will lose the ability to specify where the information is passed after the buffer. Well, I've successfully managed to confuse myself. If anyone understands my problem, and can suggest a solution then please let me know. Thanks, Ross -- From: "SCOTT FARQUHAR" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: help with Wrapping/Buffering Date: Wed, 11 Apr 2001 09:40:13 +1000 Wouldn't it be better to write your own Configurator to turn log4j logging on and off when necessary? Surely you could write it so that it would cater for whatever business logic you need.. /speculating Scott [EMAIL PROTECTED] 04/10/01 08:19pm Hi there, I've just started using log4j (and am still a newbie to java itself).I am using a wrapper class around log4j, and part of what my wrapper does is to buffer log items, only sending them to log4j when certain events occur. Clearly by doing this, I lose log4j's ability to automatically retrieve methods, line numbers etc. from the caller. It seems like what I have to do is to retrieve this information before I add an individual log to the buffer, then send it as part of the message string to log4j. Obviously I would lose some flexibility in the PatternLayout function, but this is not crucial. I understand that log4j somehow gets this information from a stack trace, but I am unsure of exactly how this works, or how I would go about getting the information for myself. Thanks in advance for any help, Ross Ovland - 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]
Re: help with Wrapping/Buffering
Ross, See how the AsyncAppender does it. Ceki At 11:19 10.04.2001 +0100, you wrote: Hi there, I've just started using log4j (and am still a newbie to java itself).I am using a wrapper class around log4j, and part of what my wrapper does is to buffer log items, only sending them to log4j when certain events occur. Clearly by doing this, I lose log4j's ability to automatically retrieve methods, line numbers etc. from the caller. It seems like what I have to do is to retrieve this information before I add an individual log to the buffer, then send it as part of the message string to log4j. Obviously I would lose some flexibility in the PatternLayout function, but this is not crucial. I understand that log4j somehow gets this information from a stack trace, but I am unsure of exactly how this works, or how I would go about getting the information for myself. Thanks in advance for any help, Ross Ovland -- Ceki Glc Web: http://qos.ch email: [EMAIL PROTECTED] or [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: help with Wrapping/Buffering
Title: RE: help with Wrapping/Buffering Hi, Ross. Have a look at the source for org.apache.log4j.spi.LocationInfo. Best regards, Jim Cakalic -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 10, 2001 5:19 AM To: [EMAIL PROTECTED] Subject: help with Wrapping/Buffering Hi there, I've just started using log4j (and am still a newbie to java itself).I am using a wrapper class around log4j, and part of what my wrapper does is to buffer log items, only sending them to log4j when certain events occur. Clearly by doing this, I lose log4j's ability to automatically retrieve methods, line numbers etc. from the caller. It seems like what I have to do is to retrieve this information before I add an individual log to the buffer, then send it as part of the message string to log4j. Obviously I would lose some flexibility in the PatternLayout function, but this is not crucial. I understand that log4j somehow gets this information from a stack trace, but I am unsure of exactly how this works, or how I would go about getting the information for myself. Thanks in advance for any help, Ross Ovland - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help with Wrapping/Buffering
Wouldn't it be better to write your own Configurator to turn log4j logging on and off when necessary? Surely you could write it so that it would cater for whatever business logic you need.. /speculating Scott [EMAIL PROTECTED] 04/10/01 08:19pm Hi there, I've just started using log4j (and am still a newbie to java itself).I am using a wrapper class around log4j, and part of what my wrapper does is to buffer log items, only sending them to log4j when certain events occur. Clearly by doing this, I lose log4j's ability to automatically retrieve methods, line numbers etc. from the caller. It seems like what I have to do is to retrieve this information before I add an individual log to the buffer, then send it as part of the message string to log4j. Obviously I would lose some flexibility in the PatternLayout function, but this is not crucial. I understand that log4j somehow gets this information from a stack trace, but I am unsure of exactly how this works, or how I would go about getting the information for myself. Thanks in advance for any help, Ross Ovland - 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: help required
Yes. Just have seperate FileAppenders with different tolerance levels. Check the FAQ on how to limit was an appender logs. -Original Message-From: jayan [mailto:[EMAIL PROTECTED]]Sent: Thursday, March 01, 2001 1:39 AMTo: [EMAIL PROTECTED]Subject: help required hi all is it possible to separete INFO,WARN,ERROR,FATAL messages to different files like INFO message to INFO.txt ,WARN to WARN.txt rather than putting it in a single file. thanks in advance jayakrishnan
RE: Help using DOMConfigurator
I'm importing the jar file into the weblogic classpath and it's trying to get the dtd out of the jar file. The program has no problem getting the other files (.class files) out of the jar file. I've deleted the dtd from the jar file and moved it to another directory and pointed the xml to the dtd there. This is less than ideal - I would prefer to keep it in the jar file. Any ideas? Cheers Geoff -Original Message- From: Ceki Glc [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 7 February 2001 17:21 To: LOG4J Users Mailing List Subject: Re: Help using DOMConfigurator Geoff, There is no need to displace the log4j.dtd file. Leave it where it was. Why is java.util.zip involved? Have you placed the files in a jar archive? Ceki At 14:02 07.02.2001 +0800, you wrote: Hello all, I'm trying to use the latest copy of log4j and trying to use the DOMConfigurator. I've taken a copy of the sample1.xml, renamed it, copied the DTD to the same directory and when I try and run: DOMConfigurator.configure(xmlFilePath); I get: log4j:ERROR Could not parse input stream [java.io.FileInputStream@86695348]. java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.init(ZipFile.java:69) at java.util.zip.ZipFile.init(ZipFile.java:84) at weblogic.utils.zip.ZipURLConnection.getInputStream(Handler.java:40) at java.net.URL.openStream(URL.java:818) at org.apache.xerces.readers.DefaultReaderFactory.createReader(DefaultReaderFa c tory.java, Co mpiled Code) at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromExternalEnti t y(DefaultEnti tyHandler.java:767) at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromExternalSubs e t(DefaultEnti tyHandler.java:566) at org.apache.xerces.framework.XMLDTDScanner.scanDoctypeDecl(XMLDTDScanner.jav a :1131) at org.apache.xerces.framework.XMLDocumentScanner.scanDoctypeDecl(XMLDocumentS c anner.java:21 77) at org.apache.xerces.framework.XMLDocumentScanner.access$0(XMLDocumentScanner. j ava:2133) at org.apache.xerces.framework.XMLDocumentScanner$PrologDispatcher.dispatch(XM L DocumentScann er.java, Compiled Code) at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner . java, Compile d Code) at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:900) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:1 2 3) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:566) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:513) Any Ideas?? Cheers, Geoff Oliphant === = IMPORTANT INFORMATION This message and any files transmitted with it are confidential and should be read only by those persons to whom it is addressed. If you have received this message in error, please notify us immediately by way of reply. Please also destroy and delete the message from your computer. Any unauthorised form of reproduction of this message is strictly prohibited. It is the duty of the recipient to virus scan and otherwise test the information provided before loading onto any computer system. SEALCORP does not warrant that the information is free of a virus or any other defect or error. SEALCORP is not liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of SEALCORP. === = - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Ceki Glc e-mail: [EMAIL PROTECTED] (preferred) av. de Rumine 5 [EMAIL PROTECTED] CH-1005 Lausanne SwitzerlandTel: ++41 21 351 23 15 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] IMPORTANT INFORMATION This message and any files transmitted with it are confidential and should be read only by those persons to whom it is addressed. If you have received this message in error, please notify us immediately by way of reply. Please also destroy and delete the message from your computer. Any unauthorised form of reproduction of this message is strictly prohibited. It is the duty of the recipient to virus scan