RE: How do I use filters in AND condition fashion?
Eric, There are some filter classes in the log4j-sandbox cvs that you might want to look at. http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4 j/filter/ MatchFilterBase.java is the base class for most of them and it allows configuration for OR and AND type filter chains. It can get a bit confusing though. Please take a look at and let me know if you can make heads or tails of it. If you have suggestions for making it clearer, or a better design, I'd like to know. thanks, -Mark > -Original Message- > From: Eric Gravel [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 19, 2003 8:50 AM > To: [EMAIL PROTECTED] > Subject: How do I use filters in AND condition fashion? > > > I've been looking at the sample code given in Ceki's Log4J > book, chapter > 6, and it seems that > if I had a filter chain such as the one below that it is a OR > condition > type statement. If there's > a match on the first filter it accepts the message and stops > processing > there. If it doesn't match > on the first one, it goes to the second filter and if there's a match > there it stop as well. > > What I'd like to do is filter message on a condition such as all > messages of level INFO and > containing the text "test" for example. Is this possible with the > current distribution of log4j? > > > > > > > > > > > > > > > Eric A. Gravel > Java Programmer/Analyst - Internet Development > > Interval International > 6262 Sunset Drive, PH-1 > Miami, FL, 33143 > Office: (305) 666-1861 x7315 > Fax: (305) 668-3409 > Email: [EMAIL PROTECTED] > > > CONFIDENTIALITY NOTE > This e-mail and any attached documentation is intended only > for the use of the individual or entity to which it is > addressed and may contain information that is privileged, > confidential, and exempt from disclosure. If any reader of > this message is not the intended recipient you are hereby > notified that any dissemination, distribution or copying of > this communication is strictly prohibited. If you have > received this communication in error, please notify the > sender immediately. Thank you. > > > - > 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: Chainsaw - viewing log files from client side
On Fri, 2003-11-21 at 05:16, Daniel J Mauer wrote: > Thanks. I have Chainsaw v1. If you let me know how to access the V2 > software I can give it a try. If the new version includes code for loading > a remote XML file via a standard URL and a static factory method to start > Chainsaw I think that might be beneficial. Hi Daniel, I have made some changes to Chainsaw to provide the features you requested. From the File menu, the is now a load a remote URL menu item. (might be a little rough around the edges, haven't done heaps of testing) You can also use the org.apache.log4j.chainsaw.LogUI method: public static void createChainsawGUI(boolean showSplash, Action shutdownAction) The Action to pass in is called if the user initiates the exit action, passing null will cause Chainsaw to use the default which is to quit the vm. You can access this from the Apache Cvs (See http://jakarta.apache.org/site/cvsindex.html for more info). Download the jakarta-log4j CVS module, and use ant to run the 'jar' target. Then you can use the generated jars, log4j-1.3alpha.jar and log4j-chainsaw-1.3alpha.jar in the classpath of your app. I would really appreciate it if you did try this out to let us know how you go, and if you have any issues, we'll try to help out as much as possible. cheers, Paul Smith - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Log4J Question
On Thu, 2003-11-20 at 22:51, Jones, Marty B. wrote: > I was wondering if Log4J will allow me to do the following: > > configure a RollingFileAppender that logs standard output. > configure a RollingFileAppender that logs info and warning output. > configure a RollingFileAppender that logs error level output. > > have a single logger that will use one of the above appenders based upon the > logging level of the log method called within a given class. Yes, you can do this. * You will need to use the XML configuration file, as this supports appender filters. * Define each of the appenders in the xml file, and create a filter section for each resepective appender based on the level. * attach all the appenders to your single logger. The wiki has a good example on this: http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/LogByLevel cheers, Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Chainsaw - viewing log files from client side
Thanks. I have Chainsaw v1. If you let me know how to access the V2 software I can give it a try. If the new version includes code for loading a remote XML file via a standard URL and a static factory method to start Chainsaw I think that might be beneficial. Dan Paul Smith <[EMAIL PROTECTED] To: Log4J Users List <[EMAIL PROTECTED]> ex.com.au> cc: Subject: Re: Chainsaw - viewing log files from client side 11/19/2003 03:12 PM Please respond to "Log4J Users List" First question, are we talking about Chainsaw v1 (part of the log4j 1.2.8 distribution), or Chainsaw v2, which accessible from CVS, but not officially released as yet. On Thu, 2003-11-20 at 02:31, Daniel J Mauer wrote: > Hi, > > I am looking for a way to view log files stored on the server from a client > machine, and am wondering if Chainsaw can be used for this purpose. I know > Chainsaw uses a JFileChooser to load files, which I believe cannot be used > to access files on a remote server? If it can, how would one restrict > access to just the directory where the log files are stored? Finally, does > anyone know how to start Chainsaw from code rather than from a script? I > would like for it to be possible for our users to start Chainsaw from our > application whenever they want to look at log files. Thanks! If you are willing to try things direct from CVS, we might be able to help. v1 of Chainsaw is not being actively maintained, but v2 is currently in heavy, if sporadic, development. Loading a remote XML file via a standard URL has not made it into the v2 version as yet. It really should be simple to do, so maybe I should get off my but and do it Starting from within a running VM would be a little difficult at the moment, I think I could add a static factory method to create one for you. Would that help? cheers, Paul Smith - 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: I need my web application to output to different log files
OK, I managed to work this out myself... log4j.rootLogger=debug, A log4j.logger.Application=debug, ApplicationA log4j.logger.Forms=debug, FormsA Standard Output log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern==%d [%p] %c %x %m%n R (Root) log4j.appender.A=org.apache.log4j.RollingFileAppender log4j.appender.A.File=iq.log log4j.appender.A.MaxFileSize=100KB log4j.appender.A.MaxBackupIndex=1 log4j.appender.A.layout=org.apache.log4j.PatternLayout log4j.appender.A.layout.ConversionPattern=%d [%p] %c %x %m%n Application log4j.appender.ApplicationA=org.apache.log4j.RollingFileAppender log4j.appender.ApplicationA.File=application.log log4j.appender.ApplicationA.MaxFileSize=100KB log4j.appender.ApplicationA.MaxBackupIndex=1 log4j.appender.ApplicationA.layout=org.apache.log4j.PatternLayout log4j.appender.ApplicationA.layout.ConversionPattern=%d %-5p %l : %m%n Holiday Forms (HF) log4j.appender.FormsA=org.apache.log4j.RollingFileAppender log4j.appender.FormsA.File=holidayforms.log log4j.appender.FormsA.MaxFileSize=100KB log4j.appender.FormsA.MaxBackupIndex=1 log4j.appender.FormsA.layout=org.apache.log4j.PatternLayout log4j.appender.FormsA.layout.ConversionPattern=%d %-5p %l : %m%n then using static Logger logger1 = Logger.getLogger("Application"); static Logger logger2 = Logger.getLogger("Forms"); Cheers! Allistair Crossley __ Intranet Senior Developer New Media Group, QAS Ltd Telephone: 020 7819 5343 __ -Original Message- From: Allistair Crossley Sent: 20 November 2003 11:37 To: [EMAIL PROTECTED] Subject: I need my web application to output to different log files Hi All, I am struggling with understanding how I may setup my webapp to output to multiple logs. At the moment I have setup one log. My log4j.properties is in my WEB-INF/classes folder and contains; log4j.rootLogger=debug, stdout, R Standard Output log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern==%d [%p] %c %x %m%n R (Root Application) log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=appA.log log4j.appender.R.MaxFileSize=100KB log4j.appender.R.MaxBackupIndex=1 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern==%d [%p] %c %x %m%n In my classes for my webapp I always use static Logger logger = Logger.getLogger("com.mycompany.appa.AClass"); Now, for the set of classes in this package I want the logging output only to go to a new log called appB.log. Could anyone suggest how I do this? Do I need to add a new appender to my log4j? Do I then override the File property of that new appender with the classes package somehow? Thanks! --- QAS Ltd. Developers of QuickAddress Software http://www.qas.com";>www.qas.com Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- - 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]
Log4J Question
I was wondering if Log4J will allow me to do the following: configure a RollingFileAppender that logs standard output. configure a RollingFileAppender that logs info and warning output. configure a RollingFileAppender that logs error level output. have a single logger that will use one of the above appenders based upon the logging level of the log method called within a given class. Thank you for your time, Marty Marty B. Jones Senior Software Engineer DailyAccess.Com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
I need my web application to output to different log files
Hi All, I am struggling with understanding how I may setup my webapp to output to multiple logs. At the moment I have setup one log. My log4j.properties is in my WEB-INF/classes folder and contains; log4j.rootLogger=debug, stdout, R Standard Output log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern==%d [%p] %c %x %m%n R (Root Application) log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=appA.log log4j.appender.R.MaxFileSize=100KB log4j.appender.R.MaxBackupIndex=1 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern==%d [%p] %c %x %m%n In my classes for my webapp I always use static Logger logger = Logger.getLogger("com.mycompany.appa.AClass"); Now, for the set of classes in this package I want the logging output only to go to a new log called appB.log. Could anyone suggest how I do this? Do I need to add a new appender to my log4j? Do I then override the File property of that new appender with the classes package somehow? Thanks! --- QAS Ltd. Developers of QuickAddress Software http://www.qas.com";>www.qas.com Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ClassCastException whilst extending Logger
Hi My scenario is that I am running a webapp consisting of JSP pages and Java classes. I have run this under WebSphere 5.x and Tomcat 4.1.x. I have overridden the Logger class in the same manner as in the Log4J example subclass/MyLogger.java. This allows per-thread logging levels to be altered at runtime. Log4J has been installed at the application server level, so that any web apps can use Log4J, as well as there being a default configuration for any default Logger created by any app. I have then configured my code to use my factory. The problem occurs if I restart the web application through the appropriate admin console on either app server. Upon starting up my classes have static fields for their logger, using my loggers overridden getInstance method which returns a Logger object which I then cast to my class (ThreadLogger). This works the first time it is called when the app server starts up and my webapp is started for the first time. But when the webapp is restarted, on calling getInstance the logger classes in particular where it retrieves the stored Logger from its static hash table in the repository, return my previous ThreadLogger object. But when I try to cast this to my ThreadLogger, it gives me a ClassCastException. I believe this is due to the fact that when a web app is restarted a new WebAppClassLoader (of what ever type dependant upon the app server) is created. So the Logger object returned after my webapp is restart was created by the first instance of the WebAppClassLoader, but it is being checked by a second instance of the WebAppClassLoader, which no longer thinks they are the same ThreadLogger class. To work around this problem under WebSphere I installed the Log4J installation under my WebApp, and changed the modules class loader order to PARENT_LAST so that it would use the Log4J instance in my webapp not the app server. This way everything (including the logger repository) is unloaded on restarting a webapp. I tried the same approach under Tomcat, but this does not appear to work, and it is continuing to use the Log4J installed and configured at the app server level, so I am unable to restart my webapp without restarting the appserver. What I am after is either a solution to how I can have Log4J installed at the app server level, but allow me to continue using, extended Loggers on a per-webapp basis. Or a recommendation on how Log4J should be installed which differs from how I have things setup. If it turns out to be a problem with Tomcat in someway, then I will post to their mailing list. Thanks for your help Tony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]