Using System prpoerties inside log4j.xml
Hello, i need to specify the location of a RollingFileAppender's logfiles by a System property. Is there anyway to do system property replacement inside the log4j.xml? I think of something like this: appender name=myAppender class=org.apache.log4j.RollingFileAppender layout class=org.apache.log4j.PatternLayout /layout /appender Any hints? Thanks, Johannes. -- View this message in context: http://www.nabble.com/Using-System-prpoerties-inside-log4j.xml-tp25219373p25219373.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Using System prpoerties inside log4j.xml
${..} actually work right away :-) Cheers, Johannes -- View this message in context: http://www.nabble.com/Using-System-prpoerties-inside-log4j.xml-tp25219373p25219405.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Problems with Chainsaw launched using Java Web Start
Hi folks, I installed Chainsaw in my Tomcat to be able to launch it remotely, I tested to launch Chainsaw using the remote url to access it and worked fine, Java Web Start can launch Chainsaw without problems, I can select my own config file that creates a new SocketReceiver to listen in port 4445 etc... The problem is that I have checked that when I launch Chainsaw like this, the port 4445 is not opened and so Clients trying to connect to that port can't send log4j messages to Chainsaw. If I launch the application as standalone (not using Java Web Start) then the port are correctly open and messages are read. Question: Is possible to use Chainsaw with Java Web Start? Any help on this? Thanks in advance, Mh 2009/8/26 Moley Harey moleyha...@gmail.com Hi Scott, I have downloaded the JNLP file and customize it with my codebase/paths etc... and Chainsaw works fine when is launched remotely. This is my environment: 1. I have installed Chainsaw standalone code and the JNLP file downloaded from Chainsaw web site in a static folder inside my Tomcat webapps. 2.I have updated the codebase path to include my own server url. 3. I launch Chainsaw from a different remote computer using the codebase url. Hope it helps! Mh 2009/8/25 Scott Deboy scott.de...@gmail.com Yes, Chainsaw can be launched via JNLP. The currently released (but old) version is available from the Download page: http://logging.apache.org/chainsaw/download.html How are you running Chainsaw now? via the 'standalone' or Mac bundles? If you're trying to view log files on a remote machine, it supports that as well, using VFSLogFilePatternReceiver - see the 'important distribution notes' link for more information or feel free to post further questions. Scott On Tue, Aug 25, 2009 at 1:37 AM, Moley Harey moleyha...@gmail.com wrote: Hi folks, I have been using Chainsaw as a GUI for displaying my log4j log messages locally. Now I need to remotely launch Chainsaw and I was wondering if is possible to launch it using Java Web Start technology... Do you now if just doing a simple JNLP file I can launch Chainsaw? Thanks in advance, Mh -- -- ~~~ — Las cosas que vemos —dijo Pistorius con voz apagada— son las mismas cosas que llevamos en nosotros. No hay más realidad que la que tenemos dentro. (Herman Hesse) http://moleyharey.blogspot.com/ --
Configure Chainsaw properties file by default
Hi folks, I have implemented a configuration file to be used by Chainsaw and in that configuration file I have added my SocketReceiver. The first time I launch Chainsaw it prompts me to select the configuration file I want to load, I was wondering if there is any internal file in Chainsaw where I can configure that manually, I mean, put the path to my config file so I do not get prompted every time. Thanks in advance, Mh
AW: Events appear incorrect inside the wrong file
Maybe the PatternLayout is not threadsafe? Try to instantiate separate instances of PatternLayout for each Logger, or synchronize on the sole instance of PatternLayout. Heri PS: It is not quite clear who calls your log method the log-Event, and how looks the other log method which writes to the traceLogger? BTW: Why don't you do the configuring through config file? There is nothing special in your configuration which cannot be done by config file! -Ursprüngliche Nachricht- Von: Markus Michel [mailto:nemocadn...@googlemail.com] Gesendet: Freitag, 28. August 2009 13:58 An: log4j-user@logging.apache.org Betreff: Events appear incorrect inside the wrong file Hi there! To be able to log and trace some events I've added a LoggingHandler class to my java project. Inside this class I'm using two different log4j logger instances - one for logging an event and one for tracing an event into different files. The initialization block of the class looks like this: public void initialize() { System.out.print(starting logging server ...); // create logger instances logLogger = Logger.getLogger(log); traceLogger = Logger.getLogger(trace); // create pattern layout String conversionPattern = %c{2} %d{ABSOLUTE} %r %p %m%n; try { patternLayout = new PatternLayout(); patternLayout.setConversionPattern(conversionPattern); } catch (Exception e) { System.out.println(error: could not create logger layout pattern); System.out.println(e); System.exit(1); } // add pattern to file appender try { logFileAppender = new FileAppender(patternLayout, logFilename, false); traceFileAppender = new FileAppender(patternLayout, traceFilename, false); } catch (IOException e) { System.out.println(error: could not add logger layout pattern to corresponding appender); System.out.println(e); System.exit(1); } // add appenders to loggers logLogger.addAppender(logFileAppender); traceLogger.addAppender(traceFileAppender); // set logger level logLogger.setLevel(Level.INFO); traceLogger.setLevel(Level.INFO); // start logging server loggingServer = new LoggingServer(logLogger, traceLogger, serverPort, this); loggingServer.start(); System.out.println( done); } To make sure that only only thread is using the functionality of a logger instance at the same time each logging / tracing method calls the logging method .info() inside a synchronized-block. One example looks like this: public void logMessage(String message) { synchronized (logFileAppender) { if (logLogger.isInfoEnabled() logFileAppender != null) { logLogger.info(instanceName + : + message); } } } If I look at the log files, I see that sometimes a event appears in the wrong file. One example: trace 10:41:30,773 11080 INFO masterControl(192.168.2.21): string broadcast message was pushed from 1267093 to vehicle 1055293 (slaveControl 1) trace 10:41:30,784 11091 INFO masterControl(192.168.2.21): string broadcast message was pushed from 1156513 to vehicle 1105792 (slaveControl 1) trace 10:41:30,796 11103 INFO masterControl(192.168.2.21): string broadcast message was pushed from 1104306 to vehicle 1055293 (slaveControl 1) trace 10:41:30,808 5 INFO masterControl(192.168.2.21): vehicle 1327879 was pushed to slave control 1 10:41:30,808 5 INFO masterControl(192.168.2.21): string broadcast message was pushed from 1101572 to vehicle 106741 (slaveControl 1) trace 10:41:30,820 11127 INFO masterControl(192.168.2.21): string broadcast message was pushed from 1055293 to vehicle 1104306 (slaveControl 1) I think that the problem occures everytime two event happen at the same time (here: 10:41:30,808). Does anybody has an idea how to solve my problem? I already tried to add a sleep() after the method call, but that doesn't helped ... BR, Markus - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Events appear incorrect inside the wrong file
Hi! Some minutes ago I solved the problem by myself: It seems like log4j is NOT completely thread-save. After synchronizing all log / trace methods using a separate object (synchronized(synObject) {} ) everything is working fine. Maybe the lib is writing the messages to a shared thread-unsafe buffer which is used by all logger instances before writing them to file?!? (That would explain why sometimes log messages appear inside the trace file) 2009/8/31 Bender Heri hben...@ergonomics.ch Maybe the PatternLayout is not threadsafe? Try to instantiate separate instances of PatternLayout for each Logger, or synchronize on the sole instance of PatternLayout. Heri PS: It is not quite clear who calls your log method the log-Event, and how looks the other log method which writes to the traceLogger? The methods are called by several threads which have access to the loggingHandler class. Inside the handler there are seperated methods for logging (- logLogger) and tracing (- traceLogger) a message BTW: Why don't you do the configuring through config file? There is nothing special in your configuration which cannot be done by config file! I think that I don't need a separate config file, because setup is very simple. BR, Markus -Ursprüngliche Nachricht- Von: Markus Michel [mailto:nemocadn...@googlemail.com] Gesendet: Freitag, 28. August 2009 13:58 An: log4j-user@logging.apache.org Betreff: Events appear incorrect inside the wrong file Hi there! To be able to log and trace some events I've added a LoggingHandler class to my java project. Inside this class I'm using two different log4j logger instances - one for logging an event and one for tracing an event into different files. The initialization block of the class looks like this: public void initialize() { System.out.print(starting logging server ...); // create logger instances logLogger = Logger.getLogger(log); traceLogger = Logger.getLogger(trace); // create pattern layout String conversionPattern = %c{2} %d{ABSOLUTE} %r %p %m%n; try { patternLayout = new PatternLayout(); patternLayout.setConversionPattern(conversionPattern); } catch (Exception e) { System.out.println(error: could not create logger layout pattern); System.out.println(e); System.exit(1); } // add pattern to file appender try { logFileAppender = new FileAppender(patternLayout, logFilename, false); traceFileAppender = new FileAppender(patternLayout, traceFilename, false); } catch (IOException e) { System.out.println(error: could not add logger layout pattern to corresponding appender); System.out.println(e); System.exit(1); } // add appenders to loggers logLogger.addAppender(logFileAppender); traceLogger.addAppender(traceFileAppender); // set logger level logLogger.setLevel(Level.INFO); traceLogger.setLevel(Level.INFO); // start logging server loggingServer = new LoggingServer(logLogger, traceLogger, serverPort, this); loggingServer.start(); System.out.println( done); } To make sure that only only thread is using the functionality of a logger instance at the same time each logging / tracing method calls the logging method .info() inside a synchronized-block. One example looks like this: public void logMessage(String message) { synchronized (logFileAppender) { if (logLogger.isInfoEnabled() logFileAppender != null) { logLogger.info(instanceName + : + message); } } } If I look at the log files, I see that sometimes a event appears in the wrong file. One example: trace 10:41:30,773 11080 INFO masterControl(192.168.2.21): string broadcast message was pushed from 1267093 to vehicle 1055293 (slaveControl 1) trace 10:41:30,784 11091 INFO masterControl(192.168.2.21): string broadcast message was pushed from 1156513 to vehicle 1105792 (slaveControl 1) trace 10:41:30,796 11103 INFO masterControl(192.168.2.21): string broadcast message was pushed from 1104306 to vehicle 1055293 (slaveControl 1) trace 10:41:30,808 5 INFO masterControl(192.168.2.21): vehicle 1327879 was pushed to slave control 1 10:41:30,808 5 INFO masterControl(192.168.2.21): string broadcast message was pushed from 1101572 to vehicle 106741 (slaveControl 1) trace 10:41:30,820 11127 INFO masterControl(192.168.2.21): string broadcast message was pushed from 1055293 to vehicle 1104306 (slaveControl 1) I think that the problem occures everytime two event happen at the same time (here: 10:41:30,808). Does anybody has an idea how to solve my problem? I already tried to add a sleep() after
Re: reading python logging from chainsaw
Thanks Scott. Is there a nightly binary build available somewhere? -- Hari On Sun, Aug 30, 2009 at 10:57 PM, Scott Deboy scott.de...@gmail.com wrote: I was able to load your events into the latest version of Chainsaw without issues. I assume you're using the version available from the log4j web site (Web Start or bundle download). There have been significant changes made to LogFilePatternReceiver since that version was released - those changes probably addressed your issues. Hopefully we'll make another release soon that will include these fixes. You could build Chainsaw yourself from source, but it's a pretty complicated and fragile process (since it requires you to build log4j and friends via maven (and resolve external dependencies). Hopefully that process will improve as well. Scott On Fri, Aug 28, 2009 at 10:43 AM, Hari Krishna Dara harid...@gmail.com wrote: Here are the lines copy pasted: 2009-08-22 20:05:24,526 root MainThread INFO STARTING ... 2009-08-22 20:05:24,526 database MainThread DEBUGConnecting ... 2009-08-22 20:05:24,542 database MainThread DEBUG F2SQLServerCursor ... 2009-08-22 20:05:24,542 database MainThread DEBUGSQL: ... SELECT ... FROM ... 2009-08-22 20:05:24,542 root MainThread INFO Starting thread ... 2009-08-22 20:05:24,542 root MainThread INFO Waiting for thread: ... 2009-08-22 20:05:24,542 worker ReportingSummarization.main INFO Thr... 2009-08-22 20:05:24,542 reportingsummarization ReportingSummarization.main INFO Starting run ... 2009-08-22 20:05:24,542 database ReportingSummarization.main DEBUG Con... -- Hari On Fri, Aug 28, 2009 at 2:51 AM, log4j-user-digest-h...@logging.apache.org wrote: From: Scott Deboy scott.de...@gmail.com To: Log4J Users List log4j-user@logging.apache.org Date: Thu, 27 Aug 2009 17:49:55 -0700 Subject: Re: reading python logging from chainsaw Sorry, file attachments are stripped from the mailing list...just provide example entries in email and I'll look into it. Scott On Thu, Aug 27, 2009 at 4:36 PM, Hari Krishna Dara harid...@gmail.com wrote: Thanks Scott. The attached file has sample log that has only one line parsed correctly (log ID: 8), the rest have it wrong. Save this file and use the below options for LogFilePatternReceiver: fileURL: file:///c:/tmp/refresh_reporting.log logFormat: TIMESTAMP LOGGER THREAD LEVEL MESSAGE name: refresh_reporting If you save to a different directory than c:\tmp, change it accordingly. If you don't use windows, you may have to change the number of slashes (not sure). Name can be anything. I don't currently have the log that I generated with fixed width of 40 characters for thread name, but if you need that I can try to generate it again (or change the attached log file to have a fixed width for thread name). I expected that to parse better, but even the log ID: 8 didn't parse in that context. -- Hari On Sun, Aug 23, 2009 at 6:49 PM, log4j-user-digest-h...@logging.apache.org wrote: -- Forwarded message -- From: Scott Deboy scott.de...@gmail.com To: Log4J Users List log4j-user@logging.apache.org Date: Fri, 21 Aug 2009 15:34:15 -0700 Subject: Re: reading python logging from chainsaw If you can post a few lines of the log containing the example text that parses correctly and incorrectly, we can probably help you figure out what needs to be changed. Scott On Fri, Aug 21, 2009 at 3:13 PM, Hari Krishna Dara harid...@gmail.com wrote: I have been occasionally using chainsaw to analyze log files generated from python. I use the LogFilePatternReceiver with a file:// url and it worked fairly well for the python log format of %(asctime)s %(name)-12s %(levelname)-8s %(message)s and chainsaw pattern of TIMESTAMP LOGGER LEVEL MESSAGE. I am now trying to get it working with the threadname in the pattern, but chainsaw doesn't seem to match the pattern properly. I changed the python format to %(asctime)s %(name)-12s %(threadName)s %(levelname)-8s %(message)s and chainsaw pattern to TIMESTAMP LOGGER THREAD LEVEL MESSAGE, however, chainsaw doesn't recognize the threadname in most of the cases. In fact, it fails to recognize the level in most cases. It appears as though, when the level is INFO, I can see the threadname and level recognized, otherwise, THREAD and LEVEL are clubbed into MSG. I then tried assigning fixed width to threadname (%(threadName)-40s), in case that is what is causing the confusion, but this actually made it even worse. Is there a way to fine tune how
Windows server 2 008 64 bit
Dear All, I would like to know whether log4j 1.2.15 works/supported on a windows server 2008 OS. any official site link to know the same. Thanks, Thanik - Ovi Mail: Create an account directly from your phone http://mail.ovi.com - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org