Dan,
The RemoteLoggingServerPlugin does not log the received events to the root
logger it just replays the LoggingEvent object that it receives. The event
will be logged to the Logger with the same name as that with which it was
originally logged before it was remoted.
An example event flow is:
You log a message to the Logger called 'green' on the RemotingClient, this
creates a LoggingEvent object.
The <root> logger has a RemotingAppender defined.
The Logger 'green' has no configuration, but it does exist. It inherits the
appenders from <root> and therefore the event is appender to the
RemotingAppender.
The RemotingAppender remotes the LoggingEvent object to the RemotingServer.
The RemoteLoggingServerPlugin listening in the RemotingServer receives the
LoggingEvent.
The RemoteLoggingServerPlugin re-logs the LoggingEvent.
The LoggingEvent still has its LoggerName set to 'green' therefore the
log4net framework on the RemotingServer will direct the event to that
Logger.
If there is no specific configuration for that Logger then the <root> (or
other parent Logger) settings will be inherited and used to append the
event.
This allows you to combine the logging from several different applications
into a single log.
If you really do need to change the LoggerName on the events that you
receive you will need to modify the
RemoteLoggingServerPlugin.RemoteLoggingSinkImpl class. Replace the LogEvents
method with the following:
public void LogEvents(LoggingEvent[] events)
{
if (events != null)
{
foreach(LoggingEvent logEvent in events)
{
if (logEvent != null)
{
LoggingEventData data = logEvent.GetLoggingEventData();
data.LoggerName = "the name of the logger to force all the events
into";
m_repository.Log(new LoggingEvent(data));
}
}
}
}
If you just overwrite the LoggerName then you will be loosing valuable
logging data so it may be better to prefix the logger name with a string
rather than replacing it.
Why do you want to log the remoted events to a different/specific logger?
Cheers,
Nicko
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: 22 April 2004 19:54
> To: [email protected]
> Subject: Remote logging to non-root logger
>
> I tried the RemoteLoggingServerPlugin example for beta8 at
> ... /examples/net/Remoting and it works GREAT, but the
> example is written / configured to only log remote messages
> to the root logger. I couldn't find anything in the API or
> documentation that says how to log remote messages to a
> specific logger (one other than root)
>
> Can the RemoteLoggingServerPlugin be configured to log remote
> messages to a different logger (other than root)?
> What would need to be changed in the example to do so?
>
> Thanks
>
> _____________________________
>
> Dan Derrig
>
> New e-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>
>
>
> Northrop Grumman Mission Systems
>
> KEI Systems Engineering / Modeling & Simulations IPT
>
> 213 Wynn Dr. Huntsville, AL 35805
>
> 256.830.3490 (o)
>
>
>
>
>
>
>