Coder Social home page Coder Social logo

Comments (6)

agusmakmun avatar agusmakmun commented on July 19, 2024 1

@seanpconkie now you can use the custom pattern at settings.py for newest version v1.0.7

pip install django-log-viewer --upgrade
LOG_VIEWER_PATTERNS = [']OFNI[', ']GUBED[', ']GNINRAW[', ']RORRE[', ']LACITIRC[']

to your custom pattern;

LOG_VIEWER_PATTERNS = [r'\]*(Z|.*)[0-9]{3}(.|,)([0-9]{1}[0-5]{1}:){2}[0-9]{1}[0-2]{1}(T|\s)[0-9]{1}[0-3]{1}-[0-9]{1}[0-1]{1}-[0-9]{4}\[*$']

from django-log-viewer.

CountBigBang avatar CountBigBang commented on July 19, 2024

I did some testing and found the reason for the problem. The log viewer expects a log format where each entry starts with [{loglevel}]. I used a format without the brackets, so no end-of-lines where detected. This should at least be mentioned in the README to prevent weary debug sessions. Of course, a more flexible approach would allow for individual formats since I am not aware of any convention specifying the log file format in Python or Django. The examples in the Django documentation do not make use of brackets.

from django-log-viewer.

agusmakmun avatar agusmakmun commented on July 19, 2024

@CountBigBang the character [ and ] are required for this plugin to identify the next line.
you can checkout at this lines.

# pattern = "; |\[INFO\] |\[DEBUG\] |\[WARNING\] |\[ERROR\] |\[CRITICAL\] "
patterns = [']OFNI[', ']GUBED[', ']GNINRAW[', ']RORRE[', ']LACITIRC[']

from django-log-viewer.

 avatar commented on July 19, 2024

@CountBigBang I changed utils to match besed on regular expressions, not gone into too much detail on the patterns but works for my logs.
patterns = ['\].*OFNI.*\[', '\].*GUBED.*\[', '\].*GNINRAW.*\[', '\].*RORRE.*\[', '\].*LACITIRC.*\['] if any([re.search(p,line) for p in patterns]):

from django-log-viewer.

 avatar commented on July 19, 2024

wanted to follow up my previous comment for anyone else who finds this - I'm on AWS EC2 and found that the below date pattern worked the best;
patterns = [r'\]*(Z|.*)[0-9]{3}(.|,)([0-9]{1}[0-5]{1}:){2}[0-9]{1}[0-2]{1}(T|\s)[0-9]{1}[0-3]{1}-[0-9]{1}[0-1]{1}-[0-9]{4}\[*$']

from django-log-viewer.

sgvolpe avatar sgvolpe commented on July 19, 2024

I think there's also an issue with the exclude argument. by default is '', which in my case makes the script read just the first entry.

from django-log-viewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.