Re: log4j1.3 alpha8 using joran configurator logs text in folds(multiples)
If you are calling doConfigure in doGet of each servlet then it is being configured multiple times -- once for each request processed. The easiest way to configure it only once is to put the config file in the classpath and allow it to be automatically configured. An alternative is to call doconfigure in static code that is only called once. On 2/27/07, Surya Poola <[EMAIL PROTECTED]> wrote: Iam sure the code is only executed once, why because without specifying any configurator and placing log4j.xml in classes folder of the web application, everything works fine.But when i specify configurator and remove the log4j.xml from classes folder and place log4j.xml in different location and refer the log4j.xml by configurator then iam facing this problem. Iam running my program through tomcat,and calling my program in doget() method of servlets like: logger=Logger.getLogger(this.getClass().getName()); JoranConfigurator jc = new JoranConfigurator(); jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository()) logger.info("test log" ); Regards Rohan James Stauffer <[EMAIL PROTECTED]> wrote: Are you sure that code is only executed once per program run? Are you running in Tomcat, and where are you calling doConfigure? On 2/27/07, Surya Poola wrote: > Iam calling jc.doconfigure only once in my program.I hope this should not be the > problem. > > > James Stauffer wrote: > Are you calling jc.doConfigure multiple times? It should only be > called once during the program run. > > On 2/27/07, Surya Poola wrote: > > Hi, > > > > When Iam using joran configurator in log4j1.3 alpha 8 version, log is written in folds into log file.ie, first call of execution of my program writes the text once, for second call it writes twice and the logging is growing exponentially for subsequent calls. > > > > my code looks like: > > JoranConfigurator jc = new JoranConfigurator(); > > jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository()) > > logger.info("test log" ); > > > > I tried using the deprecated DOMConfigurator also, but this also behaves the same ,because DOMConfigurator is extended from JoranConfigurator. > > > > But when i keep the log4j.xml file in classes folder of web application and not specifying any configurator then the logging is happening perfectly.So i hope the problem is using JoranConfigurator. > > -- > James Stauffer http://www.geocities.com/stauffer_james/ > Are you good? Take the test at http://www.livingwaters.com/good/ > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > - > No need to miss a message. Get email on-the-go > with Yahoo! Mail for Mobile. Get started. -- James Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta. - Access over 1 million songs - Yahoo! Music Unlimited. -- James Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j1.3 alpha8 using joran configurator logs text in folds(multiples)
Iam sure the code is only executed once, why because without specifying any configurator and placing log4j.xml in classes folder of the web application, everything works fine.But when i specify configurator and remove the log4j.xml from classes folder and place log4j.xml in different location and refer the log4j.xml by configurator then iam facing this problem. Iam running my program through tomcat,and calling my program in doget() method of servlets like: logger=Logger.getLogger(this.getClass().getName()); JoranConfigurator jc = new JoranConfigurator(); jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository()) logger.info("test log" ); Regards Rohan James Stauffer <[EMAIL PROTECTED]> wrote: Are you sure that code is only executed once per program run? Are you running in Tomcat, and where are you calling doConfigure? On 2/27/07, Surya Poola wrote: > Iam calling jc.doconfigure only once in my program.I hope this should not be > the > problem. > > > James Stauffer wrote: > Are you calling jc.doConfigure multiple times? It should only be > called once during the program run. > > On 2/27/07, Surya Poola wrote: > > Hi, > > > > When Iam using joran configurator in log4j1.3 alpha 8 version, log is > > written in folds into log file.ie, first call of execution of my program > > writes the text once, for second call it writes twice and the logging is > > growing exponentially for subsequent calls. > > > > my code looks like: > > JoranConfigurator jc = new JoranConfigurator(); > > jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository()) > > logger.info("test log" ); > > > > I tried using the deprecated DOMConfigurator also, but this also behaves > > the same ,because DOMConfigurator is extended from JoranConfigurator. > > > > But when i keep the log4j.xml file in classes folder of web application and > > not specifying any configurator then the logging is happening perfectly.So > > i hope the problem is using JoranConfigurator. > > -- > James Stauffer http://www.geocities.com/stauffer_james/ > Are you good? Take the test at http://www.livingwaters.com/good/ > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > - > No need to miss a message. Get email on-the-go > with Yahoo! Mail for Mobile. Get started. -- James Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta. - Access over 1 million songs - Yahoo! Music Unlimited.
Re: log4j1.3 alpha8 using joran configurator logs text in folds(multiples)
Are you sure that code is only executed once per program run? Are you running in Tomcat, and where are you calling doConfigure? On 2/27/07, Surya Poola <[EMAIL PROTECTED]> wrote: Iam calling jc.doconfigure only once in my program.I hope this should not be the problem. James Stauffer <[EMAIL PROTECTED]> wrote: Are you calling jc.doConfigure multiple times? It should only be called once during the program run. On 2/27/07, Surya Poola wrote: > Hi, > > When Iam using joran configurator in log4j1.3 alpha 8 version, log is written in folds into log file.ie, first call of execution of my program writes the text once, for second call it writes twice and the logging is growing exponentially for subsequent calls. > > my code looks like: > JoranConfigurator jc = new JoranConfigurator(); > jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository()) > logger.info("test log" ); > > I tried using the deprecated DOMConfigurator also, but this also behaves the same ,because DOMConfigurator is extended from JoranConfigurator. > > But when i keep the log4j.xml file in classes folder of web application and not specifying any configurator then the logging is happening perfectly.So i hope the problem is using JoranConfigurator. -- James Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started. -- James Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple logging files
This should do what you want: 1. Switch to XML config. 2. Define your main appender and special appender 3. Use a system property for the name of the file in the special appender. 4. Make sure you have your loggers setup so logs from the special part of your code go to the special appender. On 2/27/07, DECAFFMEYER MATHIEU <[EMAIL PROTECTED]> wrote: Thanks for your response, it's not exactly what I want actually : I have a main log where every log is stored, But in a part of my code I want to log in a separate file (and still in the main log file), the location in which I must store the logs of this block of code is told dynamically in my application in a new Log4j file (log4j.appender.file.File=). So in other words each time I execute this block of code I create a new Log4J file because I must specify a new directory where to store the logs. (e.g. first time I execute the specific block of code store log in directory 21456, second time in 14598, ...) So at the start of this code I do : PropertyConfigurator.configure(...); To load dynamically a new Log4J file (where the new location in which I store the logs is specified) But when I execute this, the logs aren't stored anymore in the main log file. I tried : ApplicationLogManager.info("test1"); PropertyConfigurator.configure(logConfigFileName); ApplicationLogManager.info("test2"); The main log file displays "test1" but nothing anymore below it. That is problem #1. Then when this block of code is exectued, I want to load again the main Log4j file, in the classpath but I don't know how to load this one PropertyConfigurator.configure(??); Maybe I'm doing this all wrong :-) ( :( ) __ Matt -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, February 26, 2007 8:55 PM To: Log4J Users List Subject: Re: Multiple logging files * This message comes from the Internet Network * Loggers inherit appenders unless they are told not to. If you add an appender to a logger and you want all logging for that logger to go only to the appender you just added to it, you'll have to set additivity="false" to this logger. log4j.additivity.com.mycompany.MyClass=false OR Jake Quoting DECAFFMEYER MATHIEU <[EMAIL PROTECTED]>: > > Hi, > > I have a main log file where all the logs are stored of the application. > But I have a block of instructions in my application and I want the logs > of this code to be stored in another log file. > > So I execute this : > > PropertyConfigurator.configure(...); > > It works ok, but the logs are now stored in both file : > the file I specified in the configure method above > the main log file > > Can anyone help ? > > Thank u. > __ > >Matt > > > > > Internet communications are not secure and therefore Fortis Banque Luxembourg > S.A. does not accept legal responsibility for the contents of this message. > The information contained in this e-mail is confidential and may be legally > privileged. It is intended solely for the addressee. If you are not the > intended recipient, any disclosure, copying, distribution or any action taken > or omitted to be taken in reliance on it, is prohibited and may be unlawful. > Nothing in the message is capable or intended to create any legally binding > obligations on either party and it is not intended to provide legal advice. > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Internet communications are not secure and therefore Fortis Banque Luxembourg S.A. does not accept legal responsibility for the contents of this message. The information contained in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Nothing in the message is capable or intended to create any legally binding obligations on either party and it is not intended to provide legal advice. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multiple logging files
Thanks for your response, it's not exactly what I want actually : I have a main log where every log is stored, But in a part of my code I want to log in a separate file (and still in the main log file), the location in which I must store the logs of this block of code is told dynamically in my application in a new Log4j file (log4j.appender.file.File=). So in other words each time I execute this block of code I create a new Log4J file because I must specify a new directory where to store the logs. (e.g. first time I execute the specific block of code store log in directory 21456, second time in 14598, ...) So at the start of this code I do : PropertyConfigurator.configure(...); To load dynamically a new Log4J file (where the new location in which I store the logs is specified) But when I execute this, the logs aren't stored anymore in the main log file. I tried : ApplicationLogManager.info("test1"); PropertyConfigurator.configure(logConfigFileName); ApplicationLogManager.info("test2"); The main log file displays "test1" but nothing anymore below it. That is problem #1. Then when this block of code is exectued, I want to load again the main Log4j file, in the classpath but I don't know how to load this one PropertyConfigurator.configure(??); Maybe I'm doing this all wrong :-) ( :( ) __ Matt -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, February 26, 2007 8:55 PM To: Log4J Users List Subject: Re: Multiple logging files * This message comes from the Internet Network * Loggers inherit appenders unless they are told not to. If you add an appender to a logger and you want all logging for that logger to go only to the appender you just added to it, you'll have to set additivity="false" to this logger. log4j.additivity.com.mycompany.MyClass=false OR Jake Quoting DECAFFMEYER MATHIEU <[EMAIL PROTECTED]>: > > Hi, > > I have a main log file where all the logs are stored of the application. > But I have a block of instructions in my application and I want the logs > of this code to be stored in another log file. > > So I execute this : > > PropertyConfigurator.configure(...); > > It works ok, but the logs are now stored in both file : > the file I specified in the configure method above > the main log file > > Can anyone help ? > > Thank u. > __ > >Matt > > > > > Internet communications are not secure and therefore Fortis Banque Luxembourg > S.A. does not accept legal responsibility for the contents of this message. > The information contained in this e-mail is confidential and may be legally > privileged. It is intended solely for the addressee. If you are not the > intended recipient, any disclosure, copying, distribution or any action taken > or omitted to be taken in reliance on it, is prohibited and may be unlawful. > Nothing in the message is capable or intended to create any legally binding > obligations on either party and it is not intended to provide legal advice. > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Internet communications are not secure and therefore Fortis Banque Luxembourg S.A. does not accept legal responsibility for the contents of this message. The information contained in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Nothing in the message is capable or intended to create any legally binding obligations on either party and it is not intended to provide legal advice. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j1.3 alpha8 using joran configurator logs text in folds(multiples)
Iam calling jc.doconfigure only once in my program.I hope this should not be the problem. James Stauffer <[EMAIL PROTECTED]> wrote: Are you calling jc.doConfigure multiple times? It should only be called once during the program run. On 2/27/07, Surya Poola wrote: > Hi, > > When Iam using joran configurator in log4j1.3 alpha 8 version, log is written > in folds into log file.ie, first call of execution of my program writes the > text once, for second call it writes twice and the logging is growing > exponentially for subsequent calls. > > my code looks like: > JoranConfigurator jc = new JoranConfigurator(); > jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository()) > logger.info("test log" ); > > I tried using the deprecated DOMConfigurator also, but this also behaves the > same ,because DOMConfigurator is extended from JoranConfigurator. > > But when i keep the log4j.xml file in classes folder of web application and > not specifying any configurator then the logging is happening perfectly.So i > hope the problem is using JoranConfigurator. -- James Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started.
Re: Display log4j.xml on jsp
You could write a custom appender to grab the logs and then have your JSP grab them from that appender. On 2/27/07, sunil nagavaram <[EMAIL PROTECTED]> wrote: Guys, Did anyone try this, displaying logs generated by log4j on jsp. If so can you please write down the steps for me Thank you -- Sunil -- James Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j1.3 alpha8 using joran configurator logs text in folds(multiples)
Are you calling jc.doConfigure multiple times? It should only be called once during the program run. On 2/27/07, Surya Poola <[EMAIL PROTECTED]> wrote: Hi, When Iam using joran configurator in log4j1.3 alpha 8 version, log is written in folds into log file.ie, first call of execution of my program writes the text once, for second call it writes twice and the logging is growing exponentially for subsequent calls. my code looks like: JoranConfigurator jc = new JoranConfigurator(); jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository()) logger.info("test log" ); I tried using the deprecated DOMConfigurator also, but this also behaves the same ,because DOMConfigurator is extended from JoranConfigurator. But when i keep the log4j.xml file in classes folder of web application and not specifying any configurator then the logging is happening perfectly.So i hope the problem is using JoranConfigurator. -- James Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Display log4j.xml on jsp
This question interest me also, Ok but is there any way to see the lines added in the logs in the JSP dynamically in an easy way ? __ Matt -Original Message- From: Julius Davies [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 27, 2007 4:30 PM To: Log4J Users List Subject: Re: Display log4j.xml on jsp * This message comes from the Internet Network * JSP's can do this! InputStream in = new FileInputStream( "/path/to/my.log" ); // ;-) (Or use a FileReader instead?) On 2/27/07, sunil nagavaram <[EMAIL PROTECTED]> wrote: > Guys, > Did anyone try this, displaying logs generated by log4j on jsp. If so can > you please write down the steps for me > > Thank you > -- > Sunil > -- yours, Julius Davies 416-652-0183 http://juliusdavies.ca/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Internet communications are not secure and therefore Fortis Banque Luxembourg S.A. does not accept legal responsibility for the contents of this message. The information contained in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Nothing in the message is capable or intended to create any legally binding obligations on either party and it is not intended to provide legal advice. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Display log4j.xml on jsp
JSP's can do this! InputStream in = new FileInputStream( "/path/to/my.log" ); // ;-) (Or use a FileReader instead?) On 2/27/07, sunil nagavaram <[EMAIL PROTECTED]> wrote: Guys, Did anyone try this, displaying logs generated by log4j on jsp. If so can you please write down the steps for me Thank you -- Sunil -- yours, Julius Davies 416-652-0183 http://juliusdavies.ca/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Display log4j.xml on jsp
Guys, Did anyone try this, displaying logs generated by log4j on jsp. If so can you please write down the steps for me Thank you -- Sunil
log4j1.3 alpha8 using joran configurator logs text in folds(multiples)
Hi, When Iam using joran configurator in log4j1.3 alpha 8 version, log is written in folds into log file.ie, first call of execution of my program writes the text once, for second call it writes twice and the logging is growing exponentially for subsequent calls. my code looks like: JoranConfigurator jc = new JoranConfigurator(); jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository()) logger.info("test log" ); I tried using the deprecated DOMConfigurator also, but this also behaves the same ,because DOMConfigurator is extended from JoranConfigurator. But when i keep the log4j.xml file in classes folder of web application and not specifying any configurator then the logging is happening perfectly.So i hope the problem is using JoranConfigurator. So could any one help me in finding a solution with JoranConfigurator. Regards, Rohan Surya Poola <[EMAIL PROTECTED]> wrote: Dirk, I have multiple instance of webapp applications .So currently i tried by saving my log4j.xml file in WEB-INF/classes folder. The file is been picked up, but i am getting the same warnings that i got earlier without any file output( Ihave switched on the debug . mode) log4j:WARN Continuable parsing error 3 and column 29 log4j:WARN Document root element "configuration", must match DOCTYPE root "null". log4j:WARN Continuable parsing error 3 and column 29 log4j:WARN Document is invalid: no grammar found. log4j:WARN The element has been deprecated. log4j:WARN Use the element instead. log4j: Threshold ="". log4j: Level value for root is [info]. log4j: root level set to INFO log4j: Class name: [org.apache.log4j.rolling.RollingFileAppender] log4j: Setting property [append] to [true]. log4j: Parsing layout of class: "org.apache.log4j.PatternLayout" log4j: Setting property [conversionPattern] to [%d{-MM-dd HH:mm:ss},%p,%c,%t %m%n]. My log4j.xml file looks like: and i just given the following stements in my code: logger=Logger.getLogger (Classname.class); logger.info("Perormance log Classname"); is the default configurator DOM or Joran .as per the output it looks like DOM. Can you help me in fixing this issue. Thanks in advance. Regards Rohan Dirk Ooms <[EMAIL PROTECTED]> wrote: Rohan, do you have multiple instances of tomcat or multiple webapps within tomcat? anyway, typically one puts the log4j.xml in the WEB-INF/classes of each webapp. it will then be picked up by JoranConfigurator (without doing anything explicit in your code, except for a getLogger()). Do not use the in version 1.3, JoranConfigurator does not accept it. dirk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started. - Any questions? Get answers on any topic at Yahoo! Answers. Try it now. - Now that's room service! Choose from over 150,000 hotels in 45,000 destinations on Yahoo! Travel to find your fit. - TV dinner still cooling? Check out "Tonight's Picks" on Yahoo! TV.