Monday, May 21, 2012
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.

Subject: Using log4net to write to remote windows event log
Prev Next
You are not authorized to post a reply.

Author Messages
Florin Daneliuc

06/22/2009 5:38 PM  


Hello,

I'm using log4net to log/trace an application and I would like to have cert= ain errors ending up in the the event log from another computer. Is there a way to do this? (RemoteSyslogAppender?)

It seems that I could do around the tree and use a ForwardingAppender which together with a application acting as server on the remote computer would could write this to the event log, but it looks a little to cumbersome.

PS I was able to change log4net to write to a remote eventlog, but I would prefer to use an "untainted" library.

Thanks,
florin

Karim Bourouba

06/22/2009 11:24 PM  
This isnt something I have ever needed to use log4net for, but there are two possibilities for you: RemotingAppender and UDPAppender. Both of these appenders appear to be able to deliver messages to remote apps, at least this is what the log4net page on config examples suggest: http://logging.apache.org/log4net/release/config-examples.html
 
There is also a SMTPAppender that could also help you out.
 
However, I dont think there is anything ready made for you that will enter these events onto another systems event log. If this is a Windows environment, then it isnt a great idea anyway. If you think about it a bit, the event log is used for the system upon which the OS and other applications are running. To me, it makes very little sense to log events from other systems here.
 
Have you considered simply using the ADONetAppender to log events to a database somewhere? This, to me at least, would be a better way of logging events - but then again I dont really know what it is you are trying to do.

Florin Daneliuc

06/23/2009 8:57 AM  
Thanks Karim.
 
In my case I have a number of systems distributed on different computers in a test environment and I would like certain errors (that would cause my application to stop) to also go into a central event log in order to be able to only inspect one event log. Emailing in my case is not something that I would use.
 
The fact that Event Log is a windows technology it not an issue, this application is windows only, log4net supports Event Log, even if not at it's full capabilities. In order to make the Event Log appender be able to write to a remote Event Log you only need about 5 lines of code changed. But of course, I'm not sure about the performance penalty and I don't know why this capability was "postponed" in the appender (this might clarify this).
 
Also there is a appender that is able to write to remote sinks, RemoteSyslogAppender, which is mostly Linux only, so using a remote sink is not something new. Windows 2008 seems to have the ability to collect logs from other computers, so somehow they have thought about something like this.
 
florin
 
Karim Bourouba

06/23/2009 9:07 AM  
Sorry, I think you may have missed my point. The event log in Windows is specific to the installation only. To me, recording things that have taken place on an a different machine in a remote systems event log doesnt look like good design.
 
Given that you have a lot of different systems you want to log with different logging criteria, wouldnt logging to a data base be a more prudent move?
 
The ability to view remote logs isnt new with Windows 2008, its been around for a while now. Bear in mind that this isnt the event log, its called the event collector and is a seperate service. You need to decide which will be better for you - if you want to rely on this (i.e. you have a tool that needs the Event Log) then you are going to have to look into this, however if you want a flexible logging system, then you may want to spend more time with log4net.


 
You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > Using log4net to write to remote windows event log



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement