-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
file format support #13
Comments
You mean you have a plain text file that was created by To do that you'd have to parse the file yourself and rewrite its contents as JSON (save a log to a file from cutelog to see how it's formatted). I didn't implement this feature natively because I thought it would be painful to try to consistently parse everything correctly since everybody likes their logs formatted differently. There's no text parsing in the code so I didn't want to write it just for this, basically. So my thinking is this: if your log files are formatted consistently, you can write a bit of code in five minutes to translate them into JSON. But if they aren't consistent, nothing I can write will help you. Although I could try to make a basic file parser to handle the simple case. |
Hi Alexander, Thank you for your quick response, Actually, I have parse the log file in JSON using something like the following in the formatters section of a dictConfig
then
That will produce a line in a log such as {"asctime": "2020-06-27 12:55:21,517", "name": "setup", "levelname": "INFO", "pathname": "/my/test/script.py", "lineno": 20, "message": "TEST MESSAGE"} But also I have tried to send the log directly to cutelog after setting the Server to parse json log files, that is, by changing the "Default serialization format" under Settings from pickle to json. but in this case I am getting a traceback at the message reception
Could you let me know how to debug please, Many thanks, |
You say that you're "sending the log directly", which could mean that you're opening a socket yourself and writing an encoded JSON string to it. If that is what you're doing, the fix is simple: you need to prefix your JSON payload with the length of that payload as described on this page in the Connection section. Basically like If that's not what you're doing and instead you're trying to use the SocketHandler with the JSON formatter, then the fix is even simpler: set the default serialization format in the settings back to pickle. SocketHandler doesn't use formatters, it always sends pickled objects. But if you're doing something else entirely, post your whole logging configuration dict and tell me how you're connecting to cutelog. |
Hi, Thanks for this awesome tool! I also am interested on how would one read records into cutelog from log files. I managed to parse an example logfile to a list of dictionaries. Each entry in the list looks like this
How would be the preferred way to open the data in EditOh, seems that I was already really close. I just had to remove the
Then, the file could be loaded to cutelog with "File -> Load Records" |
Hi @mhanuel26 @busimus |
Hi,
I am looking to see if is possible to open a logger saved directly from logging module, is would be a matter of maybe giving it the right format so cutelog can open correctly the file?
Will appreciate your comments,
The text was updated successfully, but these errors were encountered: