Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am currently working on a project where I am collecting log information from an application using Log4net and writing the information to a file. I am using Nxlog to monitor this file, parse the information contained in the file, and send the information to all of the desired locations, i.e. Loggly,etc. Everything that I have read thus far says that Nxlog either gathers log information from a network connection or from a file, I am curious as to whether Nxlog can monitor an application to gather this log information. Any help will be greatly appreciated. Thank you.
Posted
Comments
LeVar H. 28-Mar-13 10:15am    
Thank you Prasad. This was very helpful.

Hello,

No, it can not be used as a application monitoring tool. NXLOG is a universal log collector and forwarder. Although when run in server mode application can route the log information to NXLog instance via syslog. For application monitoring you may want to try Hyperic Application & System Monitoring[^]

Regards,
 
Share this answer
 
log4net:
XML
...
<appender name="UdpAppender" type="log4net.Appender.UdpAppender">
  <remoteAddress value="localhost" />
  <remotePort value="5561" />
  <layout type="log4net.Layout.SerializedLayout, log4net.Ext.Json">
  </layout>
</appender>
...


Hi, make your log4net log to a local UDP port where nxlog is listening. To simplify parsing you may add JSON formatting with my project log4net.Ext.Json. Like that, you'll skip the unnecessary file logging and relieve the application from disk IO. Running nxlog process with a higher priority than the logging app will ensure it has the upper hand on UDP and hence prevent losing logs even under heavy stress.

nxlog:
...
<Extension json>
    # We expect JSON on the UDP input, this module provides parse_json()
    Module  xm_json
</Extension>

<Input udpjson>
    # Listen on local UDP port for JSON events
    Module      im_udp
    Host    localhost
    Port    5561
</Input>
...
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900