Graylog is a log monitoring plugin for Java. The storage is MongoDB, the efficiency is very high. However, the documentation is too small, and installation and configuration are not easy.
Official website: http://www.graylog.org/
In Graylog, configure a UDP monitor mode, such as:
Then, under Log4net, the configuration is changed as follows:
<?xml version="1.0"?><configuration> <configSections> <section name="log4net"Type="log4net. Config.log4netconfigurationsectionhandler, Log4net"/> </configSections> <log4net> <appender name="Udpappender"Type="log4net. Appender.udpappender"> <param name="Encoding"Value="Utf-8"/> <remoteaddress value="192.168.1.43"/> <remoteport value="5514"/> <layout type="log4net. Layout.patternlayout"Value="<1>1%UTCDATE{YYYY-MM-DDTHH:MM:SS:FFZ} [%PROPERTY{NDC}]%logger Thread=[%thread] SOA%thread%level -%message%newline"/> </appender> <root> <appender-ref ref="Udpappender"/> <appender-ref ref="logfilebydate"/> </root> </log4net></configuration>
The configuration file is primarily paired with the IP address and port.
After an exception occurs, in the Graylog, you will see the log display:
Log4net logs uploaded to Graylog monitoring