RE: Different client's log file?
Hi for this purpose use MDC & NDC See details more Use key & values in MDC -Original Message- From: Javier Gonzalez [mailto:[EMAIL PROTECTED] Sent: Thursday, August 10, 2006 10:04 AM To: Log4J Users List Subject: Re: Different client's log file? On 8/9/06, wolverine my <[EMAIL PROTECTED]> wrote: > One or more clients connecting to the server. How can we log the > message into different client's log files? > > E.g. when there are client X, Y, Z connecting to the server. The > messages will be logged into X.log, Y.log and Z.log. > > This will be easier for us to debug when one client encounter problem. If the clients' names (every possible one) are known beforehand, you can create an appender for each client, and log to a logger named after the client - create your loggers as "Logger.getLogger(client.getName())" and attach an appender to each possible name. -- Javier González Nicolini - 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: One question about extending log4j
Hi I have extended the Rolling file appender to create separate files per thread. Attached is the implementation. For this you need to set up the log4j as log4j.appender.GetAccountInfo=com.gs.eq.pb.commodore.logger.ExtendedRollingFileAppender log4j.appender.GetAccountInfo.File=logs/GetAccountInfo.log log4j.appender.GetAccountInfo.layout=org.apache.log4j.PatternLayout log4j.appender.GetAccountInfo.layout.ConversionPattern=%d{ABSOLUTE} %5p %C{1}:%L - %m%n log4j.logger.GetAccountInfo.additivity=true log4j.appender.GetAccountInfo.MaxFileSize=1KB log4j.appender.GetAccountInfo.MaxBackupIndex=3 log4j.logger.GetAccountInfo=debug, GetAccountInfo Regards Neeraj -Original Message- From: Javier Gonzalez [mailto:[EMAIL PROTECTED] Sent: Thursday, August 10, 2006 5:31 AM To: Log4J Users List Subject: Re: One question about extending log4j On 8/9/06, 吕晓一 <[EMAIL PROTECTED]> wrote: > Hi all, > > I encountered a problem in my requirement. > > Several threads will write different type Value Object to an Object Queue, > and one Log thread will consume these VO in the Queue, and the Log thread is > extended from log4J, it will write the VO's value to different log files > according to the VO's type. > > So, what should I do? Could anybody give me a solution? For each VO, log to a different logger, named after the type of the VO. For example: // receive VO ValueObject vo = getFromQueue(); Logger log = Logger.getLogger(vo.getType()); log.log(whatever you wish to log); And then, in the log4j configuration file, create an different appender for each VO Type. Attach those appenders to the loggers named after the VO Types. -- Javier González Nicolini - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need help to use chainsaw VFSLogFilePatternReceiver
Hi, Thanks a lot for your answers, I've used Jacob's class and now I have a valid line for my remote host in my known_hosts file (though the class execution never ends). I've also checked the 'ok to remove security manager' box in the application-wide preferences. However, I still get the "file not available" error in chainsaw-log and my receiver doesn't work (the tab doesn't appear in chainsaw). Any other idea or configuration I may have missed? Thanks, Bruno - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to set log levels with jconsole?
On 2006-08-08, at 20.41, Marko Asplund wrote: I'm trying to figure out how to setup a Java SE 5 application so that jconsole can be used for modifying log levels at run time. I'd appreciate any pointers or hints on how to do this. The following lines of code seem to do the job: MBeanServer server = ManagementFactory.getPlatformMBeanServer(); HierarchyDynamicMBean h = new HierarchyDynamicMBean(); server.registerMBean(h, new ObjectName("log4j:hierarchy=default")); h.addLoggerMBean("fi.kvanttisofta"); I can monitor the appenders as well as the root and the explicitly added logger through JConsole. I'm also able to modify appender config but also change log levels at run time. Other loggers can be manually added with JConsole as needed. Is the JMX support in log4j v1.2.13 considered production quality? Are there any caveats I should be aware of? -- aspa - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need help to use chainsaw VFSLogFilePatternReceiver
Quoting Bruno Cosnefroy <[EMAIL PROTECTED]>: > Hi, > > Thanks a lot for your answers, > > I've used Jacob's class and now I have a valid line for my remote host > in my known_hosts file (though the class execution never ends). > Yeah, just hit ctrl+c. The connection is still open. I suppose I could have specified the code to close the connection, but I figured why bother. > I've also checked the 'ok to remove security manager' box in the > application-wide preferences. > > However, I still get the "file not available" error in chainsaw-log > and my receiver doesn't work (the tab doesn't appear in chainsaw). > > Any other idea or configuration I may have missed? What does you URL look like? How are you providing username/password? I can't remember the syntax to have Chainsaw prompt you, though I think that was added a while back so that you don't have to embed username/password in your config file. Scott, can you remind us of that syntax? Otherwise, you'd need to do it like so... sftp://user:[EMAIL PROTECTED]/path/from/root/to/file.ext Jake > > Thanks, > > Bruno - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Log4j 1.2.9, 64-bit, Websphere Performance Problems
We are having performance problems which we traced to overhead from our logging. Each log statemement is taking around 200 ms. The details of the logging configuration are: Log4j 1.2.8 with RollingLogFileAppender http://www.nabble.com/user-files/267/test_jsps.zip test_jsps.zip File Description 64-bit Linux 32-bit Windows logging.jsp Log 1000 iterations using only Log4j 93 ms 0.41 ms file-IO.jsp 1000 iterations small file read using pure java file utility package 0.01 ms 0.13 ms file-IO.jsp 1000 iterations writing to servlet logfile utilizing J2EE servlet API 1.67 ms 2.82 ms Log4jPerformanceTest.java Log 1000 iterations using only Log4j 0.81 ms 0.26 I have attached the source code of each test. As you can see the performance for a simple JSP which logs 1000 log statements using log4j is over 200 times slower on the 64-bit Linux vs. the 32-bit Windows machine. Does anyone have any advice? -- View this message in context: http://www.nabble.com/Log4j-1.2.9%2C-64-bit%2C-Websphere-Performance-Problems-tf2088247.html#a5755612 Sent from the Log4j - Users forum at Nabble.com.
Re: Log4j 1.2.9, 64-bit, Websphere Performance Problems
Just a clarification. I report that log4j statements were taking about 200 ms but my tests show around 100 ms. This is due to the fact that larger log statements, like the ones in the application, take longer than the small message used in the tests. -- View this message in context: http://www.nabble.com/Log4j-1.2.9%2C-64-bit%2C-Websphere-Performance-Problems-tf2088247.html#a5755664 Sent from the Log4j - Users forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]