RE: Log4J Eclipse
None that I've heard of, but that would be really, really cool. I'm imagining something like Chainsaw v2 that's just another view in Eclipse. Oooh! -Original Message- From: Alan Gutierrez [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 04, 2005 8:40 AM To: log4j-user@logging.apache.org Subject: Log4J Eclipse Is there a Log4J Eclipse plugin? One that will display Log4J messages in a table view? -- Alan Gutierrez - [EMAIL PROTECTED] - http://engrm.com/blogometer/ - 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: Using the SocketHubAppender - Reading off the socket
Here's how: ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(socket.getInputStream())); [...] LoggingEvent incomingEvent = (LoggingEvent) ois.readObject(); System.out.println(My log message was: + incomingEvent.getMessage()); System.out.println(Its level was: + incomingEvent.level.toString()); Hope that helps, Todd. -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Rakesh Patel Sent: Wednesday, September 21, 2005 3:29 PM To: log4j-user@logging.apache.org Subject: Using the SocketHubAppender - Reading off the socket Here is the scenario: 1. Program A is published its log4j messages via a SocketHubAppender on port X. 2. I have written a program where I connect to the socket on port X. I am using the standard Java socket API. I am able successfully able to connect to port X and read the socket, but the problem is I am unable to probably decode the message. How do I transform the received data on the socket to readable ASCII? Most of the data is unreadable characters. I can make out only some of the string. Thanks Rakesh - 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: Reading from SocketHubAppender Programmatically
Or you can create a socket client by wrapping a Socket object in an ObjectInputStream and reading the LoggingEvents off one by one, operating on them in however you want. That's what I do. Todd. -Original Message- From: Scott Deboy [mailto:[EMAIL PROTECTED] Sent: Friday, September 09, 2005 2:16 PM To: Log4J Users List Subject: RE: Reading from SocketHubAppender Programmatically Socket-based appenders don't use layouts - they send serialized LoggingEvent objects. 'do some processing' can be written as an appender. You can 'exam the message' using a filter attached to the appender. ExpressionFilter can examine the message and allow or prevent the processing of the event by the appender. Scott -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Rakesh Patel Sent: Friday, September 09, 2005 12:49 PM To: log4j-user@logging.apache.org Subject: Reading from SocketHubAppender Programmatically I would like to programmatically read from various SocketHubAppenders. Reason is, I was to exam the message and them do some processing based on the message. I like to write a program to do this, would the best way be to somehow use the SocketNode or another method is better? I'd like to preserve and use the layout information that was passed along in the message from the SocketHubAppender. Does anyone have a suggestion? thanks Rakesh - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problems to use Chainsaw V2 using SocketAppenders
Make sure your logging events don't have any location info in them. There is a bug that Chainsaw v2 will ignore events from log4j 1.2.x apps that include location information. See here: http://issues.apache.org/bugzilla/show_bug.cgi?id=35448 Todd. -Original Message- From: Siegfried Goeschl [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 06, 2005 11:43 AM To: log4j-user@logging.apache.org Subject: Problems to use Chainsaw V2 using SocketAppenders Hi folks, I came across the Chainsaw V2 and thought it would save my day but I'm unable to get it running +) I updated to log4j 1.2.11 since 1.3alpha6 breaks my code +) I can use the old chainsaw with no problem +) I never get any logging event using Chainsaw 2.0alpha Any ideas what went wrong Thanks in advance Siegfried Goeschl CHAINSAW CONFIG = ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true plugin name=SocketReceiver class=org.apache.log4j.net.SocketReceiver param name=Port value=4445/ /plugin root level value=debug/ /root /log4j:configuration LOG4J PROPERTIES = og4j.appender.chainsaw=org.apache.log4j.net.SocketAppender log4j.appender.chainsaw.remoteHost=localhost log4j.appender.chainsaw.port=4445 log4j.appender.chainsaw.locationInfo=true - 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: WriterAppender to sockets
I do not want to use the SocketAppender as I need to log to the socket itself. I don't understand this sentence. SocketAppender and SocketHubAppender are both ways of logging to a socket so there must be something I'm missing here. Todd. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j LoggingEvent repeater
Through trial and error, I think this problem was due to incompatibilities between log4j 1.2.8 and Chainsaw v2. I'm guessing that Chainsaw saw location information in the LoggingEvents and dropped its connection to the application's SocketHubAppender. Then, they reconnected and the same thing happened again, over and over. Anyhow, I ended up having to write my own code for the LogEventRepeater I needed. SimpleSocketServer didn't do exactly what I needed, and the underlying SocketNode didn't, either. In my case, due to this apparent incom- patibility, I needed a SocketNode that would filter out location information, plus I needed something like a SimpleSocketServer that would allow you to specify the IP address on which to listen for connections (for run- ning on a machine with multiple ethernet interfaces). But, it's all working nicely now, and I and the rest of my team are able to use Chainsaw v2 to monitor our application that's running on its own private network (with one gateway machine between it and us, which is where the LogEventRepeater runs). Chainsaw v2 really is a big improvement over v1! I can't wait for it (and log4j 1.3) to be ready for prime time and officially released. Todd. -Original Message- From: Bradley, Todd [mailto:[EMAIL PROTECTED] Sent: Thursday, June 30, 2005 3:53 PM To: Log4J Users List Subject: RE: log4j LoggingEvent repeater Thanks. That was the answer I was looking for. It does appear to do close to what I wanted. However, I can't get the darn thing to work. I turned on log4j.debug and now see that it's going into a loop of log4j: dropped connection log4j: accepting connection from ... log4j: dropped connection log4j: accepting connection from ... I'm trying to use Chainsaw v2 as my client app, and I already found the notes about not sending any location information, which I'm not doing. Any other ideas why the SimpleSocketServer would accept and then immediately drop connections? Todd. -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED] Sent: Thursday, June 30, 2005 10:37 AM To: Log4J Users List Subject: RE: log4j LoggingEvent repeater Todd, Try org.apache.log4j.net.SimpleSocketServer. I believe it does exactly what you want. At 06:21 PM 6/30/2005, Bradley, Todd wrote: I probably won't be allowed to put JBoss on the intermediate machine, although it does have a JRE. So I was hoping for a smaller, more self contained solution. Any other ideas? Todd. -- Ceki Gülcü The complete log4j manual: http://www.qos.ch/log4j/ - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Chainsaw questions
Are you looking for a binary distribution other than http://logging.apache.org/log4j/docs/webstart/chainsaw/chainsawWebStart. jnlp and http://logging.apache.org/log4j/docs/webstart/chainsaw/chainsaw-bundle.z ip? Todd. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 05, 2005 1:06 PM To: log4j-user@logging.apache.org Subject: Chainsaw questions I have attempted to follow the instructions to download, build, configure, Chainsaw version 2. They do not work at all, as, for example, ant chainsaw Buildfile: build.xml BUILD FAILED Target `chainsaw' does not exist in this project. Total time: 0 seconds Is there a binary distribution of this? Is version 1 hanging around somewhere? I would more or less echo this sentiment: http://www.leegrey.com/hmm/2005/06/07/1118183071000.html - 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 LoggingEvent repeater
Hi, I urgently need a repeater of LoggingEvents. I've got an app running on one machine (called A), an intermediate gateway machine, and my own machine (called B). B can't directly see A and vice-versa. So I want a little program I can run on the intermediate gateway. This repeater should: - open a socket to machine A, where my app will be serving up log events through a SocketHubAppender - be a socket server to machine B - listen for LoggingEvents on the wire - take events from A and retransmit to a client app on B (such as Chainsaw) What's the easiest way for me to do this? Does such a thing already exist, or do I need to write this myself? If I need to write it myself, what recommendations do you have? Todd. Todd Bradley - Polycom - QA Lead, Super Secret Project Visit me at my WebOffice for IM and app sharing: http://www.polycomweboffice.com/[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j LoggingEvent repeater
I probably won't be allowed to put JBoss on the intermediate machine, although it does have a JRE. So I was hoping for a smaller, more self contained solution. Any other ideas? Todd. -Original Message- From: Schuweiler, Joel J. [mailto:[EMAIL PROTECTED] Sent: Thursday, June 30, 2005 9:55 AM To: 'Log4J Users List' Subject: RE: log4j LoggingEvent repeater Grab jboss, have it run a socketserver (see jboss wiki). Then have an appender setup for everything that comes in of whatever type you want. Socket, Chainsaw socket, etc. -Original Message- From: Bradley, Todd [mailto:[EMAIL PROTECTED] Sent: Thursday, June 30, 2005 10:47 AM To: Log4J Users List Subject: log4j LoggingEvent repeater Hi, I urgently need a repeater of LoggingEvents. I've got an app running on one machine (called A), an intermediate gateway machine, and my own machine (called B). B can't directly see A and vice-versa. So I want a little program I can run on the intermediate gateway. This repeater should: - open a socket to machine A, where my app will be serving up log events through a SocketHubAppender - be a socket server to machine B - listen for LoggingEvents on the wire - take events from A and retransmit to a client app on B (such as Chainsaw) What's the easiest way for me to do this? Does such a thing already exist, or do I need to write this myself? If I need to write it myself, what recommendations do you have? Todd. Todd Bradley - Polycom - QA Lead, Super Secret Project Visit me at my WebOffice for IM and app sharing: http://www.polycomweboffice.com/[EMAIL PROTECTED] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j LoggingEvent repeater
Thanks. That was the answer I was looking for. It does appear to do close to what I wanted. However, I can't get the darn thing to work. I turned on log4j.debug and now see that it's going into a loop of log4j: dropped connection log4j: accepting connection from ... log4j: dropped connection log4j: accepting connection from ... I'm trying to use Chainsaw v2 as my client app, and I already found the notes about not sending any location information, which I'm not doing. Any other ideas why the SimpleSocketServer would accept and then immediately drop connections? Todd. -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED] Sent: Thursday, June 30, 2005 10:37 AM To: Log4J Users List Subject: RE: log4j LoggingEvent repeater Todd, Try org.apache.log4j.net.SimpleSocketServer. I believe it does exactly what you want. At 06:21 PM 6/30/2005, Bradley, Todd wrote: I probably won't be allowed to put JBoss on the intermediate machine, although it does have a JRE. So I was hoping for a smaller, more self contained solution. Any other ideas? Todd. -- Ceki Gülcü The complete log4j manual: http://www.qos.ch/log4j/ - 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: simple question from newcomer
I've never used it personally, but there is a JDBCAppender class for sending log messages to a database. Here is the reference page: http://logging.apache.org/log4j/docs/api/org/apache/log4j/jdbc/JDBCAppen der.html Todd. -Original Message- From: William Cai [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 05, 2005 3:46 AM To: log4j-user@logging.apache.org Subject: simple question from newcomer Hi all, Don't want to waste your time. My question is how to configure log4j, let it log to my database. Do I need to do any custom development? If yes, could you please give my some tips? Thank you! -William - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to disable log4j option using GUI?
Maybe I don't understand your question, but wouldn't it just be something like this? mySMTPAppender.close(); Todd. -Original Message- From: utpal [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 05, 2005 6:25 AM To: log4j-user@logging.apache.org Subject: How to disable log4j option using GUI? Hi All, I am displaying the mailing(smtp) option for log4j in GUI. I have set the smtp appender in log4j.properties file. While run time(i.e. using GUI) how I can disable the smtp appender? What is the way to do this...? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log4J stops logging
That is strange. Have you already tried turning on log4j debug output to see if somebody's resetting or re-reading the configuration that you don't know about? Todd. -Original Message- From: Henrik Engert [mailto:[EMAIL PROTECTED] Sent: Monday, April 04, 2005 3:30 AM To: log4j-user@logging.apache.org Subject: Log4J stops logging Hi, We have a problem with our application that uses Log4j. All of a sudden it stops logging INFO level and only keeps on logging DEBUG level. If I restart the application it works fine for a while then it stops. We are using Log4J version 1.2.8 and Java 1.4. We initialize Log4J with a property file like this: log4j.rootCategory=3DDEBUG, FILE log4j.appender.FILE=3Dorg.apache.log4j.RollingFileAppender log4j.appender.FILE.File=3D/bookit/prod/dataBI30/log/z3970.log log4j.appender.FILE.MaxFileSize=3D30MB log4j.appender.FILE.MaxBackupIndex=3D4 log4j.appender.FILE.layout=3Dorg.apache.log4j.PatternLayout log4j.appender.FILE.layout.ConversionPattern=3D%d %-4r [%t] %-5p %c %x - %m%n We are not resetting the log4J anywhere in the code or it's treshold. Any ideas? Regards, Henrik Engert ### This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange. For more information, connect to http://www.f-secure.com/ - 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: why does log4j ignore my log4j.properties definition?
Ah, thank you very much. I didn't expect that to be the case, since it's not a class. And congratulations on the new baby! One final question. I think this may be more of a Java question than a log4j question, but indulge me. Based on the newfound knowledge that the properties file needs to be in the classpath, I naturally tried this: % java -Dlog4j.debug=true -cp . -Dlog4j.configuration=mylog4j.properties -jar Proximo-Demo.jar (and a lot of variations on that) It appears that when I use the -jar command line option to java, the classpath defined with -cp is totally ignored. This is on Linux with Java 5. Looking at the man page for java, it doesn't say anything about -cp and -jar being mutually exclusive. But they seem to be, because whenever I use -jar, nothing I specify with -cp is honored. Am I crazy or is this true? Todd. -Original Message- From: Scott Deboy [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 22, 2005 2:45 PM To: Log4J Users List Subject: RE: why does log4j ignore my log4j.properties definition? config file must be in classpath. typing 1-handed - new baby boy! -Original Message- From: Bradley, Todd [mailto:[EMAIL PROTECTED] Sent: Tue 3/22/2005 1:41 PM To: Log4J Users List Cc: Subject: RE: why does log4j ignore my log4j.properties definition? Thank you for pointing out my stupid typo. However, it still doesn't work: [EMAIL PROTECTED]:~/sample-app-MS1 java -Dlog4j.debug=true -Dlog4j.configuration=mylog4j.properties -jar Proximo-Demo.jar log4j: Trying to find [mylog4j.properties] using context classloader [EMAIL PROTECTED] log4j: Trying to find [mylog4j.properties] using [EMAIL PROTECTED] class loader. log4j: Trying to find [mylog4j.properties] using ClassLoader.getSystemResource(). log4j: Could not find resource: [mylog4j.properties]. log4j:WARN No appenders could be found for logger (com.polycom.proximo.alpha.SipUA). log4j:WARN Please initialize the log4j system properly. I also tried giving it the full path to the mylog4j.properties file, and it still says Could not find resource. Todd. -Original Message- From: Scott Deboy [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 22, 2005 1:49 PM To: Log4J Users List Subject: RE: why does log4j ignore my log4j.properties definition? -Dlog4j.configuration=mylog4j.properties -Original Message- From: Bradley, Todd [mailto:[EMAIL PROTECTED] Sent: Tue 3/22/2005 12:48 PM To: Log4J Users List Cc: Subject:why does log4j ignore my log4j.properties definition? I'm running a program from a jar file that contains its own log4j.properties. However, I want to override that and tell it to use my own properties file. However, even though I give java a -Dlog4j.properties argument, it ignores that and reads in a different properties file. See here: [EMAIL PROTECTED]:~/sample-app-MS1 java -Dlog4j.debug=true -Dlog4j.properties=mylog4j.properties -jar Proximo-Demo.jar log4j: Trying to find [log4j.xml] using context classloader [EMAIL PROTECTED] log4j: Trying to find [log4j.xml] using [EMAIL PROTECTED] class loader. log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource(). log4j: Trying to find [log4j.properties] using context classloader [EMAIL PROTECTED] log4j: Using URL [jar:file:/home/tbradley/sample-app-MS1/Proximo-Demo.jar!/log4 j.properti es] for automatic log4j configuration. log4j: Reading configuration from URL jar:file:/home/tbradley/sample-app-MS1/Proximo-Demo.jar!/log4j .propertie s log4j: Parsing for [root] with value=[DEBUG,CONSOLE]. log4j: Level token is [DEBUG]. (and so on) [EMAIL PROTECTED]:~/sample-app-MS1 ls mylog4j.properties mylog4j.properties Why is it looking for and loading log4j.properties from the jar file instead of the mylog4j.properties file? This is on Linux with Java 5, if that matters. Obviously, log4j is honoring my -Dlog4j.debug=true. So, why not the name of the properties file? Todd. - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: logging not working
So... why doesn't the bf.tool.extractor.maps.EZReadMap Logger work? What do you mean by doesn't work? Do you get no output at all? Or do you get an exception? Or do you get the wrong output? What happens if you remove the config file altogether? Do you get a log4j error message to stdout? Todd. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: I tried simple-logger
Do you like it better just because of the nice docs, or are there other reasons? Todd. -Original Message- From: NetSQL [mailto:[EMAIL PROTECTED] Sent: Saturday, March 12, 2005 4:03 PM To: log4j-user@logging.apache.org Subject: ot: I tried simple-logger from Java.net and now I like it better, it's got nice docs. .V - 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: SocketHubAppender issues with socket cleanup
FWIW, since I didn't hear any other suggestions about this, I filed it as Bug 33624: http://issues.apache.org/bugzilla/show_bug.cgi?id=33624 Todd. -Original Message- From: Bradley, Todd Sent: Wednesday, February 09, 2005 3:43 PM To: 'log4j-user@logging.apache.org' Subject: SocketHubAppender issues with socket cleanup Hi, I've been using log4j the past month or so, and am fighting an unusually wily problem related to socket shutdown from SocketHubAppender. I've written a class that acts as a socket client and connects to an application using a SocketHubAppender to gather up log events. To unit test my class, I've written a test fixture that I call FileSpewer. It just reads lines from a file and sends them out as log4j log messages. So, when FileSpewer is running, it's a log source and my other class (which is called LogProxy, FWIW) is the log sink. I'm running both in their own thread. When FileSpewer's thread exits, I would expect some sort of exception to be thrown from LogProxy's socket read. Specifically, I'd expect either an EOF exception or a connection reset exception. However, I don't get either. The socket read just waits and waits for a log event that's never going to arrive (because the log source has exited). I've read the note in the docs about If the JVM hosting the SocketHubAppender exits before the SocketHubAppender is closed either explicitly or subsequent to garbage collection, then there might be untransmitted data in the pipe which might be lost. This is a common problem on Windows based systems. And I thought I might be seeing a similar issue, since I'm on Windows XP. So, I tried explicitly calling my SocketHubAppender's close(). However, it doesn't fix the problem, and causes null pointer exceptions instead (I noticed through the log4j debug messages that SocketHubAppender is trying to call serverMonitor.stopMonitor() on a serverMonitor that is null). A few other bits of info that may be useful: When I run my FileSpewer as a separate app (rather than running as a thread of my JUnit test), my socket client does get a Connection reset exception when that separate app closes down. However, when I run FileSpewer in a thread spawned by my JUnit test case, I never do get that exception. Any ideas? I've been debugging this problem all day and am at wit's end. Thanks in advance, Todd. Todd Bradley - Polycom - QA Lead, Super Secret Project Visit me at my WebOffice for IM and app sharing: http://www.polycomweboffice.com/[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: SMTPAppender configuration
Reading the javadoc for the smtp appender and its buffer size I have a doubt, what is exactly a logging event? Just this? Logger.debug(test log); Yes, that's basically it. A logging event is a Java object that contains that text message (test log) and a Level (DEBUG, in this case) and a few other useful things, such as a timestamp. See here for more details: http://logging.apache.org/log4j/docs/api/org/apache/log4j/spi/LoggingEve nt.html Todd. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: SocketHubAppender issues with socket cleanup
Thanks for the reply, Tim. Tim Mullé replied: I also had an earlier post about the SocketHubAppender creating unnecessary Socket object every second while waiting for a client to connect. Hmm, sorry I didn't see your post. I looked through the archives but didn't see anything relevant. It appears the reason for this is so the SocketHubAppender could be restarted dynamically. To fix this, I copied and pasted the code for the SocketHubAppender, removed the setting of the timeouts on the ServerSocket and added a call to serverSocket.close() in the shutdown method on the ServerMonitor inner class. Without calling close on the server socket, the log4j system hangs because the server socket is stuck in the accept() method. This is why they were using the timeout on the socket..to periodically break out of the loop to check if they should shutdown and restart. My fix is working locally and I could send a diff to the group if they wanted to see the changes... I would sure be interested in trying them out to see if it helps my problem. I've further narrowed down the problem to be in log4j somewhere (most likely the SocketHubAppender). From talking to a couple coworkers yesterday afternoon, they suggested that maybe Java 5 was treating in-JVM socket connections differently than out-of-JVM connections, and that there's a Java bug. To test that hypothesis, I wrote a simple socket server and client and did an A/B comparison of what happens when a server in a thread of your main process exits, compared to when the server is in its own separate process. In both cases, I got an java.io.EOFException, as I'd expect. So, it doesn't appear to be a Java bug. In my A case with SocketHubAppender being a thread within the same JVM as my socket client, I don't get java.io.EOFException when the server process closes. Todd. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SocketHubAppender issues with socket cleanup
Hi, I've been using log4j the past month or so, and am fighting an unusually wily problem related to socket shutdown from SocketHubAppender. I've written a class that acts as a socket client and connects to an application using a SocketHubAppender to gather up log events. To unit test my class, I've written a test fixture that I call FileSpewer. It just reads lines from a file and sends them out as log4j log messages. So, when FileSpewer is running, it's a log source and my other class (which is called LogProxy, FWIW) is the log sink. I'm running both in their own thread. When FileSpewer's thread exits, I would expect some sort of exception to be thrown from LogProxy's socket read. Specifically, I'd expect either an EOF exception or a connection reset exception. However, I don't get either. The socket read just waits and waits for a log event that's never going to arrive (because the log source has exited). I've read the note in the docs about If the JVM hosting the SocketHubAppender exits before the SocketHubAppender is closed either explicitly or subsequent to garbage collection, then there might be untransmitted data in the pipe which might be lost. This is a common problem on Windows based systems. And I thought I might be seeing a similar issue, since I'm on Windows XP. So, I tried explicitly calling my SocketHubAppender's close(). However, it doesn't fix the problem, and causes null pointer exceptions instead (I noticed through the log4j debug messages that SocketHubAppender is trying to call serverMonitor.stopMonitor() on a serverMonitor that is null). A few other bits of info that may be useful: When I run my FileSpewer as a separate app (rather than running as a thread of my JUnit test), my socket client does get a Connection reset exception when that separate app closes down. However, when I run FileSpewer in a thread spawned by my JUnit test case, I never do get that exception. Any ideas? I've been debugging this problem all day and am at wit's end. Thanks in advance, Todd. Todd Bradley - Polycom - QA Lead, Super Secret Project Visit me at my WebOffice for IM and app sharing: http://www.polycomweboffice.com/[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]