Re: Startup Error Messages
=service/ appender-ref ref=client/ /category category name=com.avexus.impresa.taglib additivity=false priority value=taglib/ appender-ref ref=client/ /category category name=com.avexus.impresa.tools additivity=false priority value=debug/ appender-ref ref=tools/ /category category name=com.avexus.impresa.util additivity=false priority value=debug/ appender-ref ref=util/ /category root priority value=warn/ appender-ref ref=util/ /root /log4j:configuration WebLogic does start up properly. And I do have some log statements in my code that do get printed to the correct files. So these messages appear to be harmless, but I'm trying to find out why there are caused. TIA. Aidan. __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- []'s Daniel Serodio CheckForte 5582-6016 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LevelMatchFilter
On Thu, 2003-02-27 at 20:14, [EMAIL PROTECTED] wrote: Everyone, Is there a way to use the LevelMatchFilter programmatically? Currently, it can be used with DOMConfigurator. AFAIK, filters can only be used with DOMConfigurator. Is there a way you can set more than one levels, for a Logger so that logEvent is called for any of these levels, it should be logged, others ignored. LevelRangeFilter? Since I am a newbie, pardon me, if I have asked something which is well-known, and please point me to the document that explains this. -Ali -- []'s Daniel Serodio CheckForte 5582-6016 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Knowing if doConfigure was called
We use boolean wasConfigured = Logger.getRoot().getAllAppenders().hasMoreElements(); []'s Daniel Serodio On Tue, 2003-02-18 at 16:08, Lutz Michael wrote: My department creates components used by applications, some of which use Log4j and some of which do not. If Log4j is used, we don't want to reconfigure Log4j in our components because we may inadvertently overwrite configuration settings made by applications. We'd just like to piggy-back off their configuration, but we have to leave the door open to those applications not using Log4j. Is it possible to know if doConfigure was called (either from DOMConfigurator or PropertyConfigurator), or is there a sneaky way in general to figure out if Log4j has been configured? We're just trying to avoid redundantly configuring Log4j in a distributed development environment. Mike PS We have the same sort of issue with MDC, in this case we can just check for null for each key. --- This message and any included attachments are from Siemens Medical Solutions Health Services Corporation and are intended only for the addressee(s). The information contained herein may include trade secrets or privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using such information is strictly prohibited and may be unlawful. If you received this message in error, or have reason to believe you are not authorized to receive it, please promptly delete this message and notify the sender by e-mail with a copy to [EMAIL PROTECTED] Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Daniel Serodio [EMAIL PROTECTED] CheckForte - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IsDebugEnabled
Calling isDebugEnabled() will avoid the cost of calculating ``Entry number: + i + is + String.valueOf(entry[i])''. There's no other way of avoiding this cost, because if you make this check inside logger, the JVM will create this concatenated String, pass this to the logger, which will then throw it away. But it will have been created already. Also, you will tipically only check isDebugEnabled(), but not isInfoEnabled(), etc. Use it only when you're concatenating many strings, or calling (directly or indirectly) an expensive toString() method. Hope this helps, Daniel Serodio On Tue, 2003-02-11 at 15:26, Ashish Jain wrote: All, I am looking at the log4j documentation and it states the following To avoid the parameter construction cost write: if(logger.isDebugEnabled() { logger.debug(Entry number: + i + is + String.valueOf(entry[i])); } I do want to avoid the parameter construction cost, but I don't want to check for IsXXXEnabled everytime I use a log statement because it makes my code clumsy. Is there a better way of doing this ? Is there a config flag somewhere ? or should I extend the logger classes and check for IsXXXenabled before calling the Log4j classes. And then my code can call my log4jextended classes. Again, I don't want to check for IsXXXEnabled every time I use a log statement. Any help is appreciated. Thks, - Ashish. - Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day -- Daniel Serodio [EMAIL PROTECTED] CheckForte - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Don't hit reply when you're not replying
Would it be too pedantic if I ask people NOT to hit the Reply button when they're not replying to some message? When the messages list is grouped by thread, messages posted as a reply to some other message are shown indented under the parent message, and when they don't belong to the same thread it makes a mess out of the messages list. Am I the only one who groups messages by thread? Am I the only one annoyed by this? -- Daniel Serodio [EMAIL PROTECTED] CheckForte - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to truncate characters in the layout of priority
Use %3p for the first 3 characters of the priority. []'s Daniel Serodio On Mon, 2003-02-03 at 11:43, Abramson, Rami wrote: Hello, How is it possible in the property file to define a layout that outputs only the first 3 characters of the priority? Output lines for example, DEB This is a test of DEBUG... FAT This is a test of FATAL... Instead of receiving, DEBUG This is a test of DEBUG... FATAL This is a test of FATAL... if we use: log4j.appender.dest1.layout.ConversionPattern=%-5p %m%n thank you, Rami A. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Daniel Serodio [EMAIL PROTECTED] CheckForte - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to truncate characters in the layout of priority
Actually, no. I always use %5p. []'s Daniel Serodio On Mon, 2003-02-03 at 13:17, Abramson, Rami wrote: Have tried it and it does not work. Have you tried it? thank you, Rami -Original Message- From: Daniel Serodio [mailto:[EMAIL PROTECTED]] Sent: Monday, February 03, 2003 3:47 PM To: Log4J Users List Subject: Re: How to truncate characters in the layout of priority Use %3p for the first 3 characters of the priority. []'s Daniel Serodio On Mon, 2003-02-03 at 11:43, Abramson, Rami wrote: Hello, How is it possible in the property file to define a layout that outputs only the first 3 characters of the priority? Output lines for example, DEB This is a test of DEBUG... FAT This is a test of FATAL... Instead of receiving, DEBUG This is a test of DEBUG... FATAL This is a test of FATAL... if we use: log4j.appender.dest1.layout.ConversionPattern=%-5p %m%n thank you, Rami A. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Daniel Serodio [EMAIL PROTECTED] CheckForte - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HI ceki
It's very rude to e-mail a developer directly with questions that should be asked on this list. Anyway, see the Javadoc for org.apache.log4j.varia.LevelMatchFilter filter class=org.apache.log4j.varia.LevelMatchFilter param name=LevelToMatch value=DEBUG / param name=AcceptOnMatch value=true / /filter ...or something like that []'s Daniel Serodio On Fri, 2003-01-31 at 17:45, vijay reddy wrote: HI , I want to generate 5 log files depends on levels in the same class. (ex: Logger logger = Logger.getLogger(com.abcd); logger.debug(debug message); 1. debug message will go to debug.log, 2. error messages will go to error.log, 3. Info messages will go to info.log, 4. warn messages will go warn.log, 5. fatal messages will go to fatal.log. Is it possible by using Log4j.Can you suggest me. Thanks, Vijay __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Daniel Serodio [EMAIL PROTECTED] CheckForte - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Logging multiple strings
On Fri, 2003-01-24 at 18:57, [EMAIL PROTECTED] wrote: I'm thinking of using log4j with the jdbc appender, to log some structured information regarding the usage of my applications. I log with something like: myLogger.info( userName + applicationName + transactionName ); I would like to be able to use a JDBC conversion pattern that would allow me to load the user name in a column, the application name into another column, and the transaction name into a third column. But, since the logger only accepts a single string as parameter, there is no way once we get into the layout specification to make a reference to individual elements. The layout only knows that my string corresponds to the %m specification. No, the logger accepts a single Object, not String. Wrap username, appname and transactionname in some king of object, and register an ObjectRenderer for this custom object. What I would need is the possibility of calling the logger with a collection of strings; then, in the layout, I could reference each string with a %1m , %2m and %3m specification - something like ... INSERT INTO TEST_TABLE ( userName, transactionName, applicationName ) VALUES ( %1m , %3m, %2m ) . I know there is no such thing in the package right now, and I don't expect it any time soon, but do you think it would be feasible? And would it be useful, or am I the only one with that kind of requirements? Serge Arsenault -- Daniel Serodio [EMAIL PROTECTED] CheckForte -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Full documentation of attributes
On Mon, 2003-01-27 at 09:20, Ashraf Fouad wrote: Is there any full documentation of attributes for appenders, and how they are written in files as properties xml? It's all fully documented in the Javadoc. All the Appenders have getter/setter methods for its attributes. eg. FileAppender has a setFile(...) method, which means that there is a File attribute that can be configured. []'s Daniel Serodio Ashraf Fouad Ayoub Senior Developer Raya Software 1 Abdel Hameed Lotfy St., Nasr City, Cairo 11371, Egypt Phone:* (202) 670-3301/2/3/4/6/8 Ext. 295 Fax: * (202) 670-3296 Email:* [EMAIL PROTECTED] Web: * http://www.rayasoftware.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Daniel Serodio [EMAIL PROTECTED] CheckForte -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Creating the rotated log files even if there is no accesses
On Fri, 2003-01-24 at 10:54, Nuno Carvalho wrote: Ceki Gülcü wrote: Hi Ceki, Is whole days go by without a single log been generated, then why do you need to rotate log files? There are days with too much traffic and some others don't. I need to rotate them on a daily basis in order to send a daily report to the marketing team. Well, you can always report that there were 0 hits on a day when no log file was generated. To answer your question, there is no NOP operation. However, you could modify DailyRollingFileAppender to roll on demand. There is such an appender. It is org.apache.log4j.varia.ExternallyRolledFileAppender The ExternallyRolledFileAppender class seems to implement a client/server solution. I need to use another approach. Thanks. Regards, Nuno Carvalho -- Daniel Serodio [EMAIL PROTECTED] CheckForte -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Creating the rotated log files even if there is no accesses
We use FileAppender and roll it over with a crontab job, along the lines of: cp $logfile $logfile-$(date -I) cat /dev/null $logfile Hope this helps. []'s Daniel Serodio On Fri, 2003-01-24 at 11:49, Nuno Carvalho wrote: Daniel Serodio wrote: On Fri, 2003-01-24 at 10:54, Nuno Carvalho wrote: Well, you can always report that there were 0 hits on a day when no log file was generated. Olá Daniel, The marketing team already have some kind of a shell script to check for specific log filenames. Therefore, I need to provide the expected behaviour they need. Any idea on how to solve this ? Is there some way to call a rollover function ? Regards, Nuno Carvalho -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Daniel Serodio [EMAIL PROTECTED] CheckForte -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: additivity in PropertyConfigurator
Shouldn't PropertyConfiguration report this as an error? []'s Daniel Serodio On Wed, 2003-01-22 at 17:43, Ebersole, Steven wrote: additivity is an attribute of the logger/category, not the appender... As such, instead of: log4j.category.com.printrak.me4=DEBUG, R4 log4j.additivity.R4=false you want: log4j.category.com.printrak.me4=DEBUG, R4 log4j.aditivity.com.printrak.me4=false |-Original Message- |From: Evans Mark-PT1167 [mailto:[EMAIL PROTECTED]] |Sent: Wednesday, January 22, 2003 1:12 PM |To: 'Log4J Users List' |Subject: additivity in PropertyConfigurator | | |I need help setting the additivity in my log4j properties |file. (It doesn't seem to be working for me.) | |I want to log a specific class (logger) to one file, (and |in my example below log a second class (logger) to another |file), while logging the rest of my classes to a third |file (root logger). | |I'm using a PropertyConfigurator. However, when I set |additivity on my category, per documentation, I still |get all messages going to the root logger's file. | |I'm following the example at |http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/P |ropertyConfigurator.html | |which shows: |log4j.additivity.SECURITY=false | |Additional additivity information is found at |http://jakarta.apache.org/log4j/docs/manual.html#additivity | |where it states: | | Appender Additivity | The output of a log statement of logger C will |go to all the appenders in C and its ancestors. This is |the meaning of the term appender additivity. | However, if an ancestor of logger C, say P, has |the additivity flag set to false, then C's output will be |directed to all the appenders in C and it's ancestors upto |and including P but not the appenders in any of the |ancestors of P. | Loggers have their additivity flag set to true |by default. |which imply that the ancestor P, when his additivity is |set to false, STILL logs messages, but doesn't pass them |to the parent. So, I guess if you set additivity on your |logger C, C messages will be logged, but not passed up |to parents. (I think that's what I'm doing...) | |Here's the details, thanks for any help. --Mark | | | | |I'm logging logger3 to log4j.3.log. |I'm logging logger4 to log4j.4.log. |I'm logging the root category to log4j.log (here are the |messages I believe don't belong.) | |Code: |... |static Category logger3 = |Category.getInstance(com.printrak.me3); |static Category logger4 = |Category.getInstance(com.printrak.me4); |... | PropertyConfigurator.configure(log4j.properties); | | | logger3.debug(This is debug to logger3/me3.); | logger4.debug(This is debug to logger4/me4.); |... | | |log4j.3.log: |2003-01-22 11:00:14,896 DEBUG [main] - This is debug to |logger3/me3. | |log4j.4.log: |2003-01-22 11:00:14,906 DEBUG [main] - This is debug to |logger4/me4. | |log4j.log: (why are these here with additivity set to false?) |2003-01-22 11:00:14,896 DEBUG [main] - This is debug to |logger3/me3. |2003-01-22 11:00:14,906 DEBUG [main] - This is debug to |logger4/me4. | | |Configuration file: | |log4j.rootCategory=WARN, R | |log4j.category.com.printrak.me3=DEBUG, R3 |log4j.category.com.printrak.me4=DEBUG, R4 | |log4j.category.com.printrak=DEBUG | |# Pattern to output the caller's file name and line number. | |log4j.appender.R=org.apache.log4j.FileAppender |log4j.appender.R.File=log4j.log |og4j.appender.R.layout=org.apache.log4j.PatternLayout |log4j.appender.R.layout.ConversionPattern=%d %5p [%t] - %m%n | |log4j.appender.R3=org.apache.log4j.FileAppender |log4j.appender.R3.File=log4j.3.log |log4j.appender.R3.layout=org.apache.log4j.PatternLayout |log4j.appender.R3.layout.ConversionPattern=%d %5p [%t] - %m%n |log4j.additivity.R3=false | |log4j.appender.R4=org.apache.log4j.FileAppender |log4j.appender.R4.File=log4j.4.log |#log4j.appender.R4.DatePattern='.'-MM-dd |log4j.appender.R4.layout=org.apache.log4j.PatternLayout |log4j.appender.R4.layout.ConversionPattern=%d %5p [%t] - %m%n |log4j.additivity.R4=false | |log4j.category.org.jboss=WARN |log4j.category.com.printrak=DEBUG | | |-- |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
Re: use my own appender
I think what you're looking for is LogManager.getRootLogger.addAppender(your appender here) On Tue, 2003-01-14 at 14:26, Steffen Koehler wrote: At version 1.1.3 I have written my own appender, a class that extends the AppenderSkeleton. Than I have activated the appender with PropertyConfigurator.configure(an object of my own appender). In the new version this method-signature doesn't exists. What can I do, to use my appender? I have nothing found in the short documentation. Thanks Steffen -- Daniel Serodio [EMAIL PROTECTED] CheckForte -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: How to rename the rolled over file?
appender name=ToFile class=org.apache.log4j.DailyRollingFileAppender param name=DatePattern value=.dd-MM-/ /appender Also, try reading the Javadoc for DailyRollingFileAppender, it's all there. On Thu, 2002-12-26 at 12:44, Milan Doshi wrote: Hello Friends, I am using Log4J version 1.2.7. I want to roll over the Log file every month and hence I am using the org.apache.log4j.DailyRollingFileAppender in my xml file. i.e: appender name=ToFile class=org.apache.log4j.DailyRollingFileAppender : : I would like to control the name of the rolled file. i.e.: currently it is named as ErrorLogs.log.2002-20-12. However I would like to name it as ErrorLogs_12-20-2002. How do I achieve this? All help in this regard would be appreciated. Thanks and regards, Milan Doshi -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Not logging to file when it no more exists
On Fri, 2002-12-20 at 12:31, Nuno Carvalho wrote: Thimo König wrote: When logging for a single file, the Log4J works fine. If the application is running, the log file is created (if it don't exist) and logged properly. However, if I delete the log file, at runtime, and some log messages are generated then the log file won't be created again and the log messages are lost forever. Am I doing something wrong ? I think this is behaviour as expected! Why do you want do delete the log file at runtime? Usually the log files are not deleted. If you are running a platform on a production system which do not should be restarted and for some unexpected reason the log file is removed, then the logging won't work anymore. In my opinion, this is wrong. It will require a restart to the platform in order to get the logging system to work. On a pontual situation, I may want to backup that log file for some reason. In that case, I will move the file to other name. If backup and rollover is what you need, you should truncate the file instead of moving it, ie cp logfile.log logfile.bak; cat /dev/null logfile.log on a Unix system. That still leaves the issue of the file disapearing. Anyway, thanks to the development team by the great job. Maybe there's a good reason for that... Regards, Nuno -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Action on one particular level
See the Javadoc for org.apache.log4j.varia.LevelMatchFilter On Thu, 2002-12-19 at 09:58, [EMAIL PROTECTED] wrote: Hi all, I'd like to be able to have this configuration for any appender (for example FileAppender): DEBUG= NOT visible INFO= visible WARN= NOT visible ERROR= NOT visible FATAL NOT visible I had a look at the documentation and I've learned that the property log4j.appender.A1.Threshold=INFO excludes the DEBUG level. But what about the other levels? I'm using Log4j 1.2.7, and it seems that a property like log4j.disable, which maybe could be useful for my need, is not recognised any more, even it was in the previous version. Do you have any suggestion for me? Is there any way to act on one particular priority level? Best regards and Merry Christmas, Alessio -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: How to log Exceptions with PatternLayout ?...
On Thu, 2002-12-19 at 13:42, Abramson, Rami wrote: Hello, Have found in log4j docs that: SimpleLayout and PatternLayout classes ignore Java Throwable errors and exceptions. HTMLLayout and XMLLayout handle them. Is it possible somehow to make the Throwables and Exceptions seen in the Fatal debug level when working with PatternLayout? I think what you need is: logger.error(Crash!, exception) instead of logger.error(exception) thank you, Rami A. -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: change the configuration file 'delay' time during runtime
AFAIK, you need to call PropertyConfigurator.configureAndWatch(log4j.properties, 100) instead of relying on default initialization On Thu, 2002-12-19 at 05:07, Abramson, Rami wrote: Hello, How is it possible to change the configuration file 'delay' time during runtime? Knowing that the default properties file that the log4j looks for is log4j.properties, I have tried to write in it: log4j.PropertyConfigurator.delay=100 but then, during runtime changing other properties in the file do not influence the debugging. thank you, Rami A. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Log4j Configuration with Servlet
I suggest adding this to the FAQ. On Thu, 2002-12-12 at 11:49, Shapira, Yoav wrote: Howdy, While Mr. (?) Lenharcik's suggestion will work, I'd suggest doing it slightly differently: use a ServletContextListener and initialize log4j in the contextInitialized() method. That will get called before any servlet's init() method. And the contextDestroyed() method of that listener is a great place to shut down log4j gracefully (LogManager.shutdown()). The container is free to unload and reload any servlet, including load-on-startup servlets, at any time, so init'ing log4j in a servlet is not always optimal. - WEB-INF/webx.ml create an entry to init the servlet while server start. One property of this entry is the path to your log4j config-file If you're using a servlet, it's init-param, if using a context listener it's a context-param. (if your file is in /classes you can use reflection CLASSNAME.class.getRessource(/configfile.lcf) Technically speaking, that's not reflection ;) But it'll work. For people like me who don't like to mix config files and compiled code, you can use the ServletContext().getResource(/pathtoyourconfigfilefromyourcontextroot) call to do the same. Yoav Shapira Millennium ChemInformatics -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: mal-formed XML
Did you try putting ?xml version=1.0 encoding=UTF-8? before the doctype? Also, get rid of the Append param in the com.shazam category, as it's giving you a warning. PS: It's better to attach the config file instead of pasting it in the message body, because we can't tell what is line 11, column 3. On Thu, 2002-11-14 at 08:33, Tom Watkins wrote: Hi, I am really having problems configuring my log4j.xml file using the DOMConfigurator (using log4j 1.2.7 with xerces 2.2.1). If anyone could help me I would be really grateful as I have scoured the mail archives and the web and cannot work this out. I am calling the code in this way: java.io.InputStream is = Config.class.getResourceAsStream(log4j.xml); DOMConfigurator dc = new DOMConfigurator(); dc.doConfigure(is, null); However, when I do this I get the following error: log4j:ERROR Parsing error on line 11 and column 3 log4j:ERROR The markup in the document preceding the root element must be well-formed. log4j:ERROR Could not parse input source [org.xml.sax.InputSourcea7efd]. org.xml.sax.SAXException: Stopping after fatal error: The markup in the document preceding the root element must be well-formed. at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1001) at org.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XMLDocume ntScanner.jav a:625) at org.apache.xerces.framework.XMLDocumentScanner.abortMarkup(XMLDocumentScanne r.java:679) at org.apache.xerces.framework.XMLDocumentScanner$PrologDispatcher.dispatch(XML DocumentScann er.java:885) at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner. java:380) at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:861) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:12 3) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:672) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616) at com.shazam.util.log.Log.clinit(Unknown Source) at com.shazam.util.config.Config.main(Unknown Source) log4j:WARN No such property [append] in org.apache.log4j.Logger. My log4j.xml is as follows: !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=false threshold=null appender name=STDOUT class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p [%t] %C{2} (%F:%L) - %m%n/ /layout /appender appender name=Standard class=org.apache.log4j.RollingFileAppender param name=File value=log_file_path/clipping.log/ param name=MaxFileSize value=log4j_MaxFileSize / param name=MaxBackupIndex value=log4j_MaxBackupIndex / param name=Append value=true / layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%-7p\t%d\t+%x +[%c] %m\t%n/ /layout /appender appender name=Exception class=org.apache.log4j.RollingFileAppender param name=File value=log_file_path/clipping_X.log/ param name=MaxFileSize value=log4j_MaxFileSize / param name=MaxBackupIndex value=log4j_MaxBackupIndex / param name=Append value=true / layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%n%n%m\t-%d+%x+%n/ /layout /appender !-- send all shazam category messages to the one shazam log file, dont log to the root's appenders -- category name=com.shazam additivity=false param name=Append value=true / priority value =log_level / appender-ref ref=Standard/ /category !-- send exceptions to the exception log. DONT send exceptions to ShazamLogstandard log -- category name=exception.shazam additivity=false appender-ref ref=Exception/ /category !-- all jboss etc messages go to the console -- root priority value =log_level / appender-ref ref=STDOUT/ /root /log4j:configuration Regards Tom -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org
Re: InvalidClassException
AFAIK, Logger is not serializable. On Thu, 2002-10-24 at 11:56, Lu, David wrote: Can someone please help? I'm guessing that the problem I'm seeing is rather common... I am running on WebLogic7 and have put log4j into a small test app. Prior to adding log4j, everything runs fine. After putting in log4j into a State class that is passed from the server side to my rmi client, I begin to see errors. My State.java has something like: private static Logger log = Logger.getLogger( org.tiaa.logpoc.catalog.statecatalog.model.State ); The errors I begin to see are: java.io.InvalidClassException: org.tiaa.logpoc.catalog.statecatalog.model.State; Local class not compatible: stream classdesc serialVersionUID=-3079158992661169 117 local class serialVersionUID=7923177255097461199 at java.io.ObjectStreamClass.validateLocalClass(ObjectStreamClass.java:5 18) at java.io.ObjectStreamClass.setClass(ObjectStreamClass.java:562) at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java :931) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:361) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:231) at weblogic.rjvm.ClassTableEntry.readExternal(ClassTableEntry.java:29) at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1207) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:381) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:231) at weblogic.rjvm.InboundMsgAbbrev.readObject(InboundMsgAbbrev.java:65) at weblogic.rjvm.InboundMsgAbbrev.read(InboundMsgAbbrev.java:37) at weblogic.rjvm.MsgAbbrevJVMConnection.readMsgAbbrevs(MsgAbbrevJVMConne ction.java:202) at weblogic.rjvm.MsgAbbrevInputStream.readMessageContext(MsgAbbrevInputS tream.java:193) at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:641) at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java:488) at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:3 68) at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java: 23) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133) --- nested within: -- weblogic.utils.AssertionError: * ASSERTION FAILED *[ Exception creating response stream ] - with nested exception: [java.io.InvalidClassException: org.tiaa.logpoc.catalog.statecatalog.model.State ; Local class not compatible: stream classdesc serialVersionUID=-307915899266116 9117 local class serialVersionUID=7923177255097461199] at weblogic.rjvm.MsgAbbrevJVMConnection.readMsgAbbrevs(MsgAbbrevJVMConne ction.java:212) at weblogic.rjvm.MsgAbbrevInputStream.readMessageContext(MsgAbbrevInputS tream.java:193) ** This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, please contact sender immediately by reply e-mail and destroy all copies. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. TIAA-CREF ** -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org
RE: ConsoleAppender and System.{out,err}.println
On Wed, 2002-10-23 at 11:57, Cakalic, James wrote: Every implementation of PrintStream (the class of System.out) that I have ever reviewed synchronized on itself (the object) around the actual I/O. So all the public print, println, and flush methods are synchronized. Whenever one of these methods is called, the output will be written uninterrupted by another call. Any problem would be when multiple PrintStream calls are used to write the detail for a single event seeing as each call would be independent (synchronization-wise) of every other call. ConsoleAppender relies on its WriterAppender superclass implemetation of append which ultimately makes one write call with the result of the layout format and then, if the layout ignoresThrowable, gets a String[] representing the Throwable and writes each String with a separate write call followed by a separate write of the LINE_SEPARATOR. So, depending on your layout, there could be quite a variance of opportunity for a non-log4j writer to jump in. Thank you, your explanation made things very clear to me. An Appender introduces another level of synchronization so that multiple Loggers using the same Appender cannot collide. So, if it is possible, the suggestion to use LoggingOutputStream to replace the PrintStream represented by System.out (see the javadoc) is probably a good way to minimize the collision between ConsoleAppender and System.out users. Actually, I'm currently using LoggingOutputStream and want to get rid of it because of the possible infinite recursion when LogLog tries to log stuff. It's already happened in my app, so for me it's not only a possibility, but an actual problem. Of course, ultimately, you'll want to replace all the System.out calls :-) Of course, that's my future goal. :) Best regards, Jim Cakalic -Original Message- From: Ceki Gülcü [mailto:ceki;qos.ch] Sent: Tuesday, October 22, 2002 3:16 PM To: Log4J Users List Subject: Re: ConsoleAppender and System.{out,err}.println AFAIK, System.out.println is synchronized. At 16:19 22.10.2002 -0300, Daniel Serodio wrote: I'm maintaining a Java app with tons of System.out.println's all around, and I'm using log4j in my (new) code. If I setup log4j to use a ConsoleAppender, will log4j's and println's output be intermixed in a predictible way? I mean, will each log message be logged until EOL at least? Does anyone have any suggestions for using System.out.println and log4j together in the same app? Thanks in advance -- []'s Daniel Serodio -- Ceki TCP implementations will follow a general principle of robustness: be conservative in what you do, be liberal in what you accept from others. -- Jon Postel, RFC 793 -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org font size=1Confidentiality Warning: This e-mail contains information intended only for the use of the individual or entity named above. If the reader of this e-mail is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, any dissemination, publication or copying of this e-mail is strictly prohibited. The sender does not accept any responsibility for any loss, disruption or damage to your data or computer system that may occur while using data contained in, or transmitted with, this e-mail. If you have received this e-mail in error, please immediately notify us by return e-mail. Thank you. -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org
RE: ConsoleAppender and System.{out,err}.println
On Wed, 2002-10-23 at 12:51, Ceki Gülcü wrote: At 12:36 23.10.2002 -0300, you wrote: On Wed, 2002-10-23 at 11:57, Cakalic, James wrote: Actually, I'm currently using LoggingOutputStream and want to get rid of it because of the possible infinite recursion when LogLog tries to log stuff. It's already happened in my app, so for me it's not only a possibility, but an actual problem. I bet that you first hit the problem and only then read the emails, correct? Admittedly, the warning about the LogLog recursion is not very visible. I read the e-mails but, in a hurry, thought I'll fix it when I need the fix. From what I gathered from those e-mails, the best solution would be to use LogLog.setPrintStream(PrintStream), but when I tried it I noticed this method was not implemented! -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org
Re: Log4j: Using servlet to init, but how to reload???
Have you tried using PropertyConfigurator.configureAndWatch(String configFilename, long delay) instead of configure(String filename)? On Wed, 2002-10-23 at 18:00, Carson, Chuck wrote: I am using a servlet to intialize log4j as so: public class Log4jInit extends HttpServlet { public void init() { String prefix_dir = getServletContext().getRealPath(/); String param_file = getInitParameter(log4j-init-file); PropertyConfigurator.configure(prefix_dir + param_file); } public void doGet(HttpServletRequest req, HttpServletResponse res) { } public void doPost(HttpServletRequest req, HttpServletResponse res) { } } I have this in ROOT/WEB-INF/web.xml: servlet servlet-nameLog4jInit/servlet-name servlet-classLog4jInit/servlet-class init-param param-namelog4j-init-file/param-name param-valueWEB-INF/log4j.config/param-value /init-param load-on-startup1/load-on-startup /servlet This works fine, however, any changes made to log4j.config do not take effect until the server is restarted. Is the something I can code or something I can configure to change this? Much thanks, Chuck -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org
ConsoleAppender and System.{out,err}.println
I'm maintaining a Java app with tons of System.out.println's all around, and I'm using log4j in my (new) code. If I setup log4j to use a ConsoleAppender, will log4j's and println's output be intermixed in a predictible way? I mean, will each log message be logged until EOL at least? Does anyone have any suggestions for using System.out.println and log4j together in the same app? Thanks in advance -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org
Re: Log4j Version
Extract the contents of the jar file and look at the manifest (MANIFEST.MF) file. It should have a Implementation-Version: line. On Fri, 2002-10-04 at 01:46, Manish Gupta wrote: Is there any way to check the version of log4j. I have so many log4j.jar files and wants to know their versions. Regards. Manish Gupta. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Multiple appenders for a category
Take a look at org.apache.log4j.varia.LevelMatchFilter and LevelRangeFilter. Example: root level value=debug/ appender-ref ref=err.log / appender-ref ref=out.log / /root appender name=out.log class=org.apache.log4j.FileAppender param name=Append value=true / param name=File value=log/out.log / layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=[%d{DATE}] %5p [%t] (%F:%M:%L) - %m%n / /layout filter class=org.apache.log4j.varia.LevelRangeFilter param name=LevelMin value=DEBUG / param name=LevelMax value=INFO / param name=AcceptOnMatch value=true / /filter filter class=org.apache.log4j.varia.DenyAllFilter/ /appender appender name=err.log class=org.apache.log4j.FileAppender param name=Append value=true / param name=File value=log/err.log / layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=[%d{DATE}] %5p [%t] (%F:%M:%L) - %m%n / /layout filter class=org.apache.log4j.varia.LevelRangeFilter param name=LevelMin value=WARN / param name=LevelMax value=FATAL / param name=AcceptOnMatch value=true / /filter filter class=org.apache.log4j.varia.DenyAllFilter/ /appender On Fri, 2002-09-27 at 09:51, Johannes Carlén wrote: Hi, I'd like to have multiple appenders to a single category. That is, for example, log all debug messages to console and all errors to file. I have read that you could set a threshold on an appender, but I haven't been able to figure out how. Strangely enough! This must be a very common requirement... Does anyone have an example of an xml-config for this? Thanks /Johannes _ Gratis e-mail resten av livet på www.yahoo.se/mail Busenkelt! -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: multiple categories same config file
When you set a's additivity to false, it won't inherit root's Log2Console appender. So, try adding: log4j.category.a=DEBUG, aa, Log2Console log4j.category.b=DEBUG, bb, Log2Console On Mon, 2002-09-09 at 15:15, J IK wrote: Hi Swami: tried that too but it ended up not logging to the console, may be I'm doing something wrong. this is what I added log4j.additivity.a=false log4j.additivity.b=false to no avail. thankx for your pointers. -Jik --- Swami Iyer [EMAIL PROTECTED] wrote: I think using the additivity flag will avoid the log4j in opening both the files. Swami -Original Message- From: J IK [mailto:[EMAIL PROTECTED]] Sent: September 9, 2002 2:01 PM To: [EMAIL PROTECTED] Subject: multiple categories same config file Hi All: Following is my configuration file log4j.config: log4j.rootCategory=WARN, Log2Console log4j.appender.Log2Console=org.apache.log4j.ConsoleAppender log4j.appender.Log2Console.Target=System.err log4j.appender.Log2Console.layout=org.apache.log4j.PatternLayout log4j.appender.Log2Console.layout.ConversionPattern=[%d{dd MMM HH:mm:ss}]%c-%-5p: %m%n # Main component's properties log4j.category.a=DEBUG, aa log4j.category.b=DEBUG, bb # SyncServer properties log4j.appender.aa=org.apache.log4j.RollingFileAppender log4j.appender.aa.File=aa.log log4j.appender.aa.MaxFileSize=1KB log4j.appender.aa.MaxBackupIndex=10 log4j.appender.aa.layout=org.apache.log4j.PatternLayout log4j.appender.aa.layout.ConversionPattern=[%d{dd MMM HH:mm:ss}]%c-%-5p: %m%n # Admin properties log4j.appender.bb=org.apache.log4j.RollingFileAppender log4j.appender.bb.File=bb.log log4j.appender.bb.MaxFileSize=1KB log4j.appender.bb.MaxBackupIndex=10 log4j.appender.bb.layout=org.apache.log4j.PatternLayout log4j.appender.bb.layout.ConversionPattern=[%d{dd MMM HH:mm:ss}]%c-%-5p: %m%n Now log4j is opening both the files aa.log and bb.log when i just instantiate the 'aa' appender in a JVM. This is locking the file 'bb.log' which is used by another application in a different JVM. This is causing rollover problems etc. I can eliminate the problem by using two different log4j config files and by listing different appender properties in those two but I want to avoid that and use a single config file for ease of maintenance. Please let me know if/how I can do that. Thanks in advance. Regards, -Jik __ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.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! Finance - Get real-time stock quotes http://finance.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Log4j SocketServer
On Tue, 2002-08-27 at 10:18, Kettal, El-Yamine wrote: Hi, I have the following question regarding the class SocketServer.java (used to allow TCP connection): In the function main, when a connection is accepted a thread is created at the following line: new Thread(new SocketNode(socket, h)).start(); As the reference to this thread is not kept any where in the program then this thread will be in the list of items to be cleaned by the garbage collector. Threads are only GC'ed when not running, i.e., when run() returns. Thus, when the socket node and the thread are both cleaned by GC then the TCP appender will have to reconnect again. My question is: Are the log4j TCP server and appender using one socket for several logging events (until the TCP appender is closed) or is the TCP server creating a socket node for every one or two logging events (depending on socket status (deleted or not)).? Thanks El-Yamine Kettal -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Filtering by Priority
This worked great! Thanks a lot. On Tue, 2002-05-14 at 11:37, Maha Asad wrote: Hi, Here is a sample of doing this using filters, hope it works Maha ?xml version=1.0 encoding=UTF-8? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true appender name=A1 class=org.apache.log4j.FileAppender param name=Append value=false / param name=File value=temp1 / layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%-5p %c{2} - %m\n/ /layout filter class=org.apache.log4j.varia.LevelRangeFilter param name=LevelMin value=DEBUG / param name=LevelMax value=INFO / param name=AcceptOnMatch value=true / /filter !-- Deny (filter out) everything else. -- filter class=org.apache.log4j.varia.DenyAllFilter/ /appender appender name=A2 class=org.apache.log4j.FileAppender param name=Append value=false / param name=File value=temp2 / layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%-5p %c{2} - %m\n/ /layout filter class=org.apache.log4j.varia.LevelRangeFilter param name=LevelMin value=WARN / param name=LevelMax value=FATAL / param name=AcceptOnMatch value=true / /filter !-- Deny (filter out) everything else. -- filter class=org.apache.log4j.varia.DenyAllFilter/ /appender root priority value=debug/ appender-ref ref=A1 / appender-ref ref=A2 / /root /log4j:configuration Daniel Serodio [EMAIL PROTECTED] wrote: Hi! How can I make logging requests with priority DEBUG and INFO go to one appender, and WARNING, ERROR or FATAL go to another? Thank you very much. -- []'s Daniel Serodio -- To unsubscribe, e-mail: For additional commands, e-mail: - Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Filtering by Priority
Hi! How can I make logging requests with priority DEBUG and INFO go to one appender, and WARNING, ERROR or FATAL go to another? Thank you very much. -- []'s Daniel Serodio -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]