agusmakmun / django-log-viewer

Django Log Viewer allows you to read & download log files in the admin page
https://pypi.org/project/django-log-viewer/
MIT License
74 stars 30 forks source link

newline #30

Closed zszep closed 2 years ago

zszep commented 2 years ago

There's no newline when viewing the logs. Everything is one big line.

agusmakmun commented 2 years ago

Hello @zszep for reporting this issue, seems like happen because of "Not Found" exclude. \ meanwhile, I modify that exclude to the settings, but by default is None;

LOG_VIEWER_EXCLUDE_TEXT_PATTERN = None  # String regex expression to exclude the log from line

can you please upgrade your package which following this command:

pip install django-log-viewer --upgrade

Please tell us what happen after doing upgrade, is it resolved the issue or not.

cc @tulgaab, @ananasn, @radialmed, @ashok-rai, @jamol1741

ashok-rai commented 2 years ago

No, It has not changed the log entries in the new iterable row as displayed in the documentation. @agusmakmun, Is there any extra setup that we are missing to make the log entries in new lines as shown in the image

agusmakmun commented 2 years ago

@ashok-rai can you show me the screenshot of your logs? or you can paste the plain of logs here, so I can identify.

ashok-rai commented 2 years ago

@agusmakmun,

This is my log file

Screen Shot 2022-08-29 at 11 51 51 AM

And, this is the log_viewer UI which doesnot show the log entries with each new lines in the log file

Screen Shot 2022-08-29 at 11 51 44 AM
agusmakmun commented 2 years ago

ok thanks @ashok-rai, seems your logs not using double [ and ] to present the log format: https://github.com/agusmakmun/django-log-viewer/blob/master/log_viewer_demo/log_viewer_demo/logger.py#L17

"[%(levelname)s] %(asctime)s %(name)s: %(message)s"

/|\           /|\

to remember that we have pattern in settings as well:

LOG_VIEWER_PATTERNS = ['[INFO]', '[DEBUG]', '[WARNING]', '[ERROR]', '[CRITICAL]']

so, you need to make sure both setup are corrects.

ashok-rai commented 2 years ago

Thank you @agusmakmun, this solves the issues.Now, it is working as expected.