logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damon McDougald <robspierr...@yahoo.com>
Subject Re: socketAppender + SimpleSocketServer
Date Thu, 13 Mar 2008 14:52:14 GMT


I tried attaching my src code so others can recreate, how can I do this?  Read below.

Alright, so I tried some addition steps and it worked for a couple of tries and then it stopped
working.  My client code runs on a windows box and the server portion is running on a unix(solaris
9) box.  

Here are the additional steps I took, before logging me message I performed a "log.warn("
");" and it seemed to work, but after a couple of test it stopped logging to the logging event.
 Here is my output from my server during log4j.debug=true:

log4j: Parsing for [root] with value=[DEBUG,R].
log4j: Level token is [DEBUG].
log4j: Category root set to DEBUG
log4j: Parsing appender named "R".
log4j: Parsing layout options for "R".
log4j: Setting property [conversionPattern] to [%d{DATE} (%x) %-5p %c{1} %m%n].
log4j: End of parsing for "R".
log4j: Setting property [file] to [mylog.log].
log4j: Setting property [maxFileSize] to [5MB].
log4j: Setting property [maxBackupIndex] to [5].
log4j: setFile called: mylog.log, true
log4j: setFile ended
log4j: Parsed "R" options.
log4j: Parsing for [com.dupont.arch.common.writeR07772.R07772Write] with value=[DEBUG,F].
log4j: Level token is [DEBUG].
log4j: Category com.dupont.arch.common.writeR07772.R07772Write set to DEBUG
log4j: Parsing appender named "F".
log4j: Parsing layout options for "F".
log4j: Setting property [conversionPattern] to [%m%n].
log4j: End of parsing for "F".
log4j: Setting property [maxFileSize] to [5MB].
log4j: Setting property [file] to [test.log].
log4j: Setting property [maxBackupIndex] to [3].
log4j: setFile called: test.log, true
log4j: setFile ended
log4j: Parsed "F" options.
log4j: Handling log4j.additivity.com.dupont.arch.common.writeR07772.R07772Write=[false]
log4j: Setting additivity for "com.dupont.arch.common.writeR07772.R07772Write" to false
log4j: Finished configuring.

Here is my logging debug output for my client:
log4j: Parsing for [root] with value=[DEBUG,socket].
log4j: Level token is [DEBUG].
log4j: Category root set to DEBUG
log4j: Parsing appender named "socket".
log4j: Setting property [port] to [13333].
log4j: Setting property [remoteHost] to [ndceis04.lvs.dupont.com].
log4j: Parsed "socket" options.
log4j: Finished configuring.

Attached is my scrubbed code that anyone can test to recreate my issue.   Make sure you run
the client and server portion on different boxes.  I works fine when I run both on my local
development box.  The Junit test TestRemoteLog works, but the WriteR0772test does not work.
 Here is the output of mylog.log for both tests:

13 Mar 2008 09:27:34,471 () INFO  SimpleSocketServer Listening on port 13333
13 Mar 2008 09:27:34,522 () INFO  SimpleSocketServer Waiting to accept a new client.
13 Mar 2008 09:28:38,082 () INFO  SimpleSocketServer Listening on port 13333
13 Mar 2008 09:28:38,114 () INFO  SimpleSocketServer Waiting to accept a new client.
13 Mar 2008 09:33:53,966 () INFO  SimpleSocketServer Connected to client at /52.97.5.106
13 Mar 2008 09:33:53,967 () INFO  SimpleSocketServer Starting new socket node.
13 Mar 2008 09:33:53,977 () INFO  SimpleSocketServer Waiting to accept a new client.
13 Mar 2008 09:33:54,030 () INFO  SocketNode Caught java.net.SocketException closing conneciton.
13 Mar 2008 09:34:47,366 () INFO  SimpleSocketServer Connected to client at /52.97.5.106
13 Mar 2008 09:34:47,366 () INFO  SimpleSocketServer Starting new socket node.
13 Mar 2008 09:34:47,367 () INFO  SimpleSocketServer Waiting to accept a new client.
13 Mar 2008 09:34:47,392 () INFO  SocketNode Caught java.net.SocketException closing conneciton.
13 Mar 2008 09:41:09,711 () INFO  SimpleSocketServer Connected to client at /52.97.5.106
13 Mar 2008 09:41:09,711 () INFO  SimpleSocketServer Starting new socket node.
13 Mar 2008 09:41:09,713 () INFO  SimpleSocketServer Waiting to accept a new client.
13 Mar 2008 09:40:42,281 () DEBUG TestRemoteLog Damon0
13 Mar 2008 09:40:42,296 () DEBUG TestRemoteLog Damon1
13 Mar 2008 09:40:42,296 () DEBUG TestRemoteLog Damon2
13 Mar 2008 09:40:42,296 () DEBUG TestRemoteLog Damon3
13 Mar 2008 09:40:42,312 () DEBUG TestRemoteLog Damon4
13 Mar 2008 09:40:42,312 () DEBUG TestRemoteLog Damon5
13 Mar 2008 09:40:42,312 () DEBUG TestRemoteLog Damon6
13 Mar 2008 09:40:42,312 () DEBUG TestRemoteLog Damon7
13 Mar 2008 09:40:42,312 () DEBUG TestRemoteLog Damon8
13 Mar 2008 09:40:42,312 () DEBUG TestRemoteLog Damon9
13 Mar 2008 09:41:09,781 () INFO  SocketNode Caught java.net.SocketException closing conneciton.
13 Mar 2008 09:41:39,123 () INFO  SimpleSocketServer Connected to client at /52.97.5.106
13 Mar 2008 09:41:39,124 () INFO  SimpleSocketServer Starting new socket node.
13 Mar 2008 09:41:39,125 () INFO  SimpleSocketServer Waiting to accept a new client.
13 Mar 2008 09:41:39,186 () INFO  SocketNode Caught java.net.SocketException closing conneciton.

I am using log4j version 1.2.15

----- Original Message ----
From: Damon McDougald <robspierre19@yahoo.com>
To: Log4J Users List <log4j-user@logging.apache.org>
Sent: Wednesday, March 12, 2008 11:44:05 PM
Subject: Re: socketAppender + SimpleSocketServer

I have tried all steps that you listed.  When I write my client code to the console appender
or file appender it works everytime.  When I use debug, on both the client and server I am
not seeing errors.  When I run the SimpleSocketServer on my dev box my test.log gets the message
everytime.  It only breaks when I move the server piece to a remote server.  The server runs
java 1.4.2 and I run 1.5.  I captured the packets and when I am debugging my code in eclipse,
logging works when logging to a remote server.  The request sends 11 packets per request.
 If I run my code without debugging I only see 9 packets.  Not sure what is choking but it
looks like the client is failing to send the logging event after the server acks the initial
log4J request to the simple socket server.  

----- Original Message ----
From: Jacob Kjome <hoju@visi.com>
To: Log4J Users List <log4j-user@logging.apache.org>
Sent: Wednesday, March 12, 2008 10:42:11 PM
Subject: Re: socketAppender + SimpleSocketServer


Have you tried using -Dlog4j.debug=true?  Or, if you change to using a regular 
appender, such as a Console appender or FileAppender, does it work then?

Jake

Damon McDougald wrote:
> Hey guys, I can get the socketAppender and SimpleSocketServer to work while I am debugging
my code.  But, when I run my Junit Test outside of debug Nothing happens.  Has anyone experienced
this before?
> 
> Here is my client file:
> log4j.rootLogger=INFO,S
> log4j.appender.S=org.apache.log4j.net.SocketAppender
> log4j.appender.S.Port=13333
> log4j.appender.S.RemoteHost=xxxx.com
> 
> Here is my server file:
> log4j.rootLogger=DEBUG,R
> 
> 
> log4j.logger.com.xxx.R07772Write=INFO,F
> log4j.additivity.com.xxx.R07772Write=false
> 
> # Rolling File Appender
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=mylog.log
> log4j.appender.R.MaxFileSize=5MB
> log4j.appender.R.MaxBackupIndex=5
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%d{DATE} (%x) %-5p %c{1} %m%n
> 
> # Rolling File Appender (F)
> log4j.appender.F=org.apache.log4j.RollingFileAppender
> log4j.appender.F.File=test.log
> log4j.appender.F.MaxFileSize=5MB
> log4j.appender.F.MaxBackupIndex=3
> log4j.appender.F.layout=org.apache.log4j.PatternLayout
> log4j.appender.F.layout.ConversionPattern=%m%n
> 
> 
> 
> 
>       ____________________________________________________________________________________
> Looking for last minute shopping deals?  
> Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org






      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org






      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs




      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message