this is my part of code.i use log.info() function to send to my rsyslog server,but the format is different from my console log.
public class Syslog
{
private static final Logger log = LoggerFactory.getLogger(Syslog.class);
public static void main(String[] args)
{
User user1 = new User("张三",12, "male", "shenzhen");
User user2 = new User("李四", 45, "male", "shanghaoi");
User user3 = new User("王五", 34, "female", "wuhan");
User user4 = new User("赵六", 44, "female", "hangzhu");
String s = JSONObject.toJSONString(user1);
while(true)
{
try {
log.info("{}",JSONObject.toJSONString(user2));
log.info("{}",JSONObject.toJSONString(user3));
log.info("{}",JSONObject.toJSONString(user4));
Thread.sleep(3000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}