You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Simple Mortal <si...@earthling.net> on 2003/07/16 07:40:59 UTC

Help with RMI

Hi gurus,

Kudos for this excellent logging tool. 

I'm just stuck with a dilemma. I've used Log4j on standalone applications before this and it work fine. But now I wanna use it with a client-Server application ( RMI communication ). 

Confused regarding how I can configure log4j loggers on Client and Server side.. The Client logger must be able to send crucial failure logs over to the Server and maintain program execution logs on Client side itself. The Server logger will be just another basic logger. 

Please gimme some tips on how to set up the loggers for this one. 

Regards
SimpleMortal

-- 
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

CareerBuilder.com has over 400,000 jobs. Be smarter about your job search
http://corp.mail.com/careers


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


RE: Help with RMI

Posted by Thomas Muller <tt...@online.no>.
Simple,

There are several solutions to your problem. The "simplest" is to have one
or several overloaded log methods defined in your remote interfaces, and
your client can remote-log via these interfaces. A better solution might be
to have an RMIAppender that communicates with a remote object which handles
the LoggingEvents.

I took the liberty to scratch a few lines to start you on the second
approach. Please find attached file RemoteLogger.java, RemoteLoggerImpl.java
and RMIAppender.java.

Here is how you do it:

1. On the server side you need to register the RemoteLoggerImpl in the
Registry, e.g. during application startup.

2. On the client side you can add the RMIAppender to any Logger you like (in
the log4j.properties or   log4j.xml file). The RMIAppender accept these
parameters: host, port, remoteLoggerRegistryName. They all have sensible
default values.

3. The server side log4j configuration file must pair sensible Loggers and
Appenders. If you e.g. have a client side Logger named x.y.z, you add a
Logger x.y.z and pair it with e.g. a FileAppender.

Note: The code is totally untested, but it does compile without errors. It
does by _no_ means hold up to production quality standards.

Hope this helps,

--

Thomas




| -----Original Message-----
| From: Simple Mortal [mailto:simplemortal@earthling.net]
| Sent: 16 July 2003 06:41
| To: log4j-user@jakarta.apache.org
| Subject: Help with RMI
|
|
| Hi gurus,
|
| Kudos for this excellent logging tool.
|
| I'm just stuck with a dilemma. I've used Log4j on standalone
| applications before this and it work fine. But now I wanna use it
| with a client-Server application ( RMI communication ).
|
| Confused regarding how I can configure log4j loggers on Client
| and Server side.. The Client logger must be able to send crucial
| failure logs over to the Server and maintain program execution
| logs on Client side itself. The Server logger will be just
| another basic logger.
|
| Please gimme some tips on how to set up the loggers for this one.
|
| Regards
| SimpleMortal
|
| --
| __________________________________________________________
| Sign-up for your own FREE Personalized E-mail at Mail.com
| http://www.mail.com/?sr=signup
|
| CareerBuilder.com has over 400,000 jobs. Be smarter about your job search
| http://corp.mail.com/careers
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: log4j-user-help@jakarta.apache.org
|
|


*************************************************************************
Copyright ERA Technology Ltd. 2003. (www.era.co.uk). All rights reserved. 
The information supplied in this Commercial Communication should be treated
in confidence.
No liability whatsoever is accepted for any loss or damage 
suffered as a result of accessing this message or any attachments.


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________