sevdokimov / log-viewer

Web UI for viewing logs
Apache License 2.0
434 stars 103 forks source link

Does not detect format when asci color codes are in logs #170

Closed DineshSolanki closed 1 year ago

DineshSolanki commented 1 year ago

Thanks for making such a useful and great tool first, I wanted to report the following issue - it doesn't properly format the logs when log file contains asci color codes such as -

22-03-2023 06:17:49.800 [http-nio-9100-exec-8] INFO  

its an slf4j log

DineshSolanki commented 1 year ago

even if I remove the ansi codes using sed -

 sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" input.log > output.log

it still doesn't auto recognize the format, but works(and I love it) after I manually specify the format ,in this case the format is -

%date{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %5level %logger{36} - %msg%n
sevdokimov commented 1 year ago

Fixed. %date{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %5level %logger{36} - %msg%n format will be detected automatically, ascii color codes will be removed automatically.