项目中log4j 文件
测试代码
logstash配置文件
log4j.rootLogger = debug,logstash
#输出日志到logstash
log4j.appender.logstash=org.apache.log4j.net.SocketAppender
log4j.appender.logstash.RemoteHost=192.168.22.75
log4j.appender.logstash.port=4560
log4j.appender.logstash.ReconnectionDelay=60000
log4j.appender.logstash.LocationInfo=true
测试代码
@Test
public void testU(){
logger.debug("This is a debug message!");
logger.info("This is info message!");
logger.warn("This is a warn message!");
logger.error("This is error message!");
}
logstash配置文件
input {
log4j {
mode => "server"
host => "192.168.22.75"
port => 4560
}
}
output
{
stdout { }
}
0 个回复