logging

Logging multiline messages in heroku

☆樱花仙子☆ 提交于 2021-02-09 20:41:57
问题 I'm developing an application using NodeJS and deployed in Heroku. I need to log multi-line messages (eg. stacktraces and other multiline information) but would like to retain them as one log message each. The problem is that when using console.log (or any framework that uses console.log / stdout ) with a multiline message it's interpreted like multiple messages by Heroku (one message per each line in the original message). I think the problem lies in that Heroku reads the messages from the

LOG4J2: Multiple loggers, to multiple appenders, at different logging levels

北慕城南 提交于 2021-02-09 11:30:49
问题 What I'm trying to do is pretty straight forward: <?xml version="1.0" encoding="UTF-8"?> <Configuration> <Appenders> <Console name="Console"> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> </Console> <File name = "hibernateFile" fileName = "${artifactId}/logs/hibernate.log"> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> </File> <File name = "springFile" fileName = "${artifactId}/logs/spring.log"> <PatternLayout pattern="%d{HH:mm

Logging in a Python script is not working: results in empty log files

你离开我真会死。 提交于 2021-02-09 10:51:10
问题 I had a script with logging capabilities, and it stopped working (the logging, not the script). I wrote a small example to illustrate the problem: import logging from os import remove from os.path import exists def setup_logger(logger_name, log_file, level=logging.WARNING): # Erase log if already exists if exists(log_file): remove(log_file) # Configure log file l = logging.getLogger(logger_name) formatter = logging.Formatter('%(message)s') fileHandler = logging.FileHandler(log_file, mode='w')

Logging in a Python script is not working: results in empty log files

痞子三分冷 提交于 2021-02-09 10:49:56
问题 I had a script with logging capabilities, and it stopped working (the logging, not the script). I wrote a small example to illustrate the problem: import logging from os import remove from os.path import exists def setup_logger(logger_name, log_file, level=logging.WARNING): # Erase log if already exists if exists(log_file): remove(log_file) # Configure log file l = logging.getLogger(logger_name) formatter = logging.Formatter('%(message)s') fileHandler = logging.FileHandler(log_file, mode='w')

Why is inotify losing events?

孤街浪徒 提交于 2021-02-08 21:19:21
问题 I need to process large (~100s) of syslog messages using Perl and Linux::Inotify2. I wrote a test script which generates log messages continuously. To process events, my Perl script looks like this- #!/usr/bin/perl use Linux::Inotify2 ; use Time::HiRes qw(usleep nanosleep); # create a new object my $inotify = new Linux::Inotify2 or die "Unable to create new inotify object: $!" ; # create watch $inotify->watch ("/var/log/messages", IN_ACCESS|IN_OPEN|IN_CLOSE|IN_MODIFY|IN_Q_OVERFLOW) or die

gunicorn log-config access_log_format

老子叫甜甜 提交于 2021-02-08 14:00:07
问题 I want gunicorn to log JSON in my docker container. I want to use --access-logformat in the config file. Trying to add format or access_log_format or access_logformat does not configure the logger. How do I configure the access_log_format to output JSON? http://docs.gunicorn.org/en/stable/settings.html#access-log-format gunicorn_logging.conf [loggers] keys=root, gunicorn.error, gunicorn.access [handlers] keys=console [formatters] keys=json [logger_root] level=INFO handlers=console access_log

How can we make logging sql statements in hibernate 5 and payara 5 [glassfish] work

隐身守侯 提交于 2021-02-08 10:23:21
问题 Iam forced to apply this question because everything else documented is not working. Goal: To log SQL statements as they are executed in the DB along with their bounded variables. Environment: Payara 5.182, Hibernate 5.3.2, SLF4j with Logback. It seems that the official approach is NOT to touch the persistence.xml to enable hibernate logging but to properly configure the logging framework. pom.xml <!-- Logging --> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic<

Python logging dump upon failure

大兔子大兔子 提交于 2021-02-08 10:20:49
问题 I'm using Python to write a service that reads from a message queue. For each message, it runs a process and upon completion will grab another message from the queue. I am using the logging package to log info, warnings, and errors. If the process fails for whatever reason, the process will catch the error and send out an email with the traceback. I would like for the email to also contain the logs from when the application began processing the message. To be clear - I would still like the

Python logging dump upon failure

家住魔仙堡 提交于 2021-02-08 10:20:28
问题 I'm using Python to write a service that reads from a message queue. For each message, it runs a process and upon completion will grab another message from the queue. I am using the logging package to log info, warnings, and errors. If the process fails for whatever reason, the process will catch the error and send out an email with the traceback. I would like for the email to also contain the logs from when the application began processing the message. To be clear - I would still like the

How can we make logging sql statements in hibernate 5 and payara 5 [glassfish] work

廉价感情. 提交于 2021-02-08 10:19:41
问题 Iam forced to apply this question because everything else documented is not working. Goal: To log SQL statements as they are executed in the DB along with their bounded variables. Environment: Payara 5.182, Hibernate 5.3.2, SLF4j with Logback. It seems that the official approach is NOT to touch the persistence.xml to enable hibernate logging but to properly configure the logging framework. pom.xml <!-- Logging --> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic<