mbok / logsniffer

logsniffer is a sophisticated open source web tool for parsing, viewing, monitoring and analyzing log data - smarter, collaborative and easier. [No longer maintaned]
GNU Lesser General Public License v3.0
105 stars 46 forks source link

log4j Conversion Pattern Issue #94

Open marcolino7 opened 7 years ago

marcolino7 commented 7 years ago

Hi, I have an home automation app, that use log4j to write logs. In the logs configuration file, the layout.pattern is:

%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-50.50c] - %m%n

An example of log written is: 26-Sep-2017 20:12:44.099 [DEBUG] [openhab.binding.mihome.handler.XiaomiBridgeHandler] - Updated "last time seen" for device 158d0001231ff5 26-Sep-2017 20:12:44.099 [DEBUG] [b.binding.mihome.handler.XiaomiSensorMotionHandler] - Item got update: {"cmd":"heartbeat","model":"motion","sid":"158d0001231ff5","short_id":17800,"data":"{\"voltage\":3015,\"status\":\"no_motion\"}"} 26-Sep-2017 20:12:44.099 [TRACE] [b.binding.mihome.handler.XiaomiSensorMotionHandler] - Got status "no_motion" - Apart from "report" all other status updates for sensors seem not right (Firmware 1.4.1.145) 26-Sep-2017 20:12:44.099 [TRACE] [.binding.mihome.internal.socket.XiaomiBridgeSocket] - Data received and notified 1 listeners 26-Sep-2017 20:12:44.099 [TRACE] [.binding.mihome.internal.socket.XiaomiBridgeSocket] - Thread waiting for data on port 9898 26-Sep-2017 20:12:45.195 [TRACE] [openhab.binding.mihome.handler.XiaomiBridgeHandler] - Received message {"cmd":"heartbeat","model":"gateway","sid":"286c0789175f","short_id":"0","token":"SsFmM9QZ5N1x2xHr","data":"{\"ip\":\"192.168.1.211\"}"} 26-Sep-2017 20:12:45.195 [DEBUG] [openhab.binding.mihome.handler.XiaomiBridgeHandler] - Updated "last time seen" for device 286c0789175f 26-Sep-2017 20:12:45.195 [DEBUG] [b.binding.mihome.handler.XiaomiActorGatewayHandler] - Item got update: {"cmd":"heartbeat","model":"gateway","sid":"286c0789175f","short_id":"0","token":"SsFmM9QZ5N1x2xHr","data":"{\"ip\":\"192.168.1.211\"}"} 26-Sep-2017 20:12:45.195 [TRACE] [.binding.mihome.internal.socket.XiaomiBridgeSocket] - Data received and notified 1 listeners 26-Sep-2017 20:12:45.195 [TRACE] [.binding.mihome.internal.socket.XiaomiBridgeSocket] - Thread waiting for data on port 9898

I tried to use as Conversion pattern I use to write file, and I did some other tries, but I also get pattern error:

image

Many T hanks in advance.

Marco

mbok commented 7 years ago

Hi Marco,

Please try a less strict pattern withot modifiers: %d{yyyy-MM-dd HH:mm:ss.SSS} [%p] [%c] - %m%n

This pattern should be sufficient for parsing the logs without taking truncation and paddings etc. into account.

Best, Michael