logging

why TimedRotatingFileHandler does not delete old files?

♀尐吖头ヾ 提交于 2020-01-14 14:11:27
问题 I am using TimedRotatingFileHandler to create my logs. I want my log files to be created every minute, keep at most 2 log files and delete older ones. Here is the sample code: import logging import logging.handlers import datetime logger = logging.getLogger('MyLogger') logger.setLevel(logging.DEBUG) handler = logging.handlers.TimedRotatingFileHandler( "logs/{:%H-%M}.log".format(datetime.datetime.now()), when="M", backupCount=2) logger.addHandler(handler) logger.debug("PLEASE DELETE PREVIOUS

How to control fluentd log tag from Docker

青春壹個敷衍的年華 提交于 2020-01-14 13:46:32
问题 Current setup is running Docker containers with the fluentd driver: docker run --log-driver=fluentd my-container That works quite easily...sends stdout to the locally running fluentd system on the host. I'd like to control the fluentd tag using some of the labels which are set on the container. For this example, assume some labels ( docker inspect snippet): "Config": { "Labels": { "com.amazonaws.ecs.container-name": "web", "com.amazonaws.ecs.task-definition-version": "3" } } How can I set the

Should logging be affected by Internationalisation?

时光总嘲笑我的痴心妄想 提交于 2020-01-14 12:56:26
问题 We are currently looking into shipping our set of products to other parts of the world. We will be ensuring that all strings and date formats,etc in the user interfaces reflect the language and culture of the target country. Should our log files and error reporting also be changed in this way? Considering the customers may dip into the log files or we may have a support team local to that country, troubleshooting and reporting of problems would be made easier if the relevant reports were in

Unable to set property [lockingModel] on object [log4net.Appender.RollingFileAppender] using value [MinimalLock]

帅比萌擦擦* 提交于 2020-01-14 12:35:37
问题 I am getting this error in my C# application. I am using log4net as a logging tool. Here is my app.config file: <configuration> <configSections> <section name="log4net" type ="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/> </configSections> <log4net> <root> <level value="ALL" /> <appender-ref ref="myLogger" /> </root> <appender name="myLogger" type="log4net.Appender.RollingFileAppender,log4net"> <param name="File" value="C:\MyApp\Logs\appLog.txt" /> <param name="AppendToFile"

Unable to set property [lockingModel] on object [log4net.Appender.RollingFileAppender] using value [MinimalLock]

隐身守侯 提交于 2020-01-14 12:34:18
问题 I am getting this error in my C# application. I am using log4net as a logging tool. Here is my app.config file: <configuration> <configSections> <section name="log4net" type ="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/> </configSections> <log4net> <root> <level value="ALL" /> <appender-ref ref="myLogger" /> </root> <appender name="myLogger" type="log4net.Appender.RollingFileAppender,log4net"> <param name="File" value="C:\MyApp\Logs\appLog.txt" /> <param name="AppendToFile"

How do you stop a TextWriterTraceListener from appending using app.config?

三世轮回 提交于 2020-01-14 10:09:04
问题 I'm using System.Diagnostics.TraceSource for logging and one of my listeners is a TextWriterTraceListener. In the tracing primer here it sets this up as follows: <listeners> <add initializeData="output.txt" type="System.Diagnostics.TextWriterTraceListener" name="myLocalListener" /> </listeners> The problem is that this will always append to output.txt. How do you alter this to an overwrite in the config file? Programmatically the listener I want is a: new TextWriterTraceListener(new

LogManager.getLogger stalls Application for ~10-30 Seconds when using JDK8:

天大地大妈咪最大 提交于 2020-01-14 10:00:12
问题 // UPDATE 1: I did some more testing, removed most of the libs and commented out lib specific code resulting in the same behaviour which leeds me to the conclusion, that this problem is not (directly) caused by those libs but seems to be a general issue in my code and/or setup. The main problem here is that I do not understand why it runs perfectly when launched from within eclipse (instant startup, high performance, etc) while the same code has the described problems as soon as i launch it

Sortable, readable and standard time format for logs

∥☆過路亽.° 提交于 2020-01-14 09:09:44
问题 Timestamp format in logs Most log lines contain a timestamp and event description: [When] [What] e.g.: [23/Jul/2013:19:35:11 +0000] Processing started. [23/Jul/2013:19:36:11 +0000] Processed 1000 items. [23/Jul/2013:19:37:11 +0000] Processing finished successfully. I am trying to find a standard timestamp for my log lines. My criteria is: Human readable . I want to easily understand when did the event happen. Alphabetically sortable . When I grep events from a few files and sort them using

Sortable, readable and standard time format for logs

做~自己de王妃 提交于 2020-01-14 09:04:18
问题 Timestamp format in logs Most log lines contain a timestamp and event description: [When] [What] e.g.: [23/Jul/2013:19:35:11 +0000] Processing started. [23/Jul/2013:19:36:11 +0000] Processed 1000 items. [23/Jul/2013:19:37:11 +0000] Processing finished successfully. I am trying to find a standard timestamp for my log lines. My criteria is: Human readable . I want to easily understand when did the event happen. Alphabetically sortable . When I grep events from a few files and sort them using

is <math.h> for C or C++?

喜夏-厌秋 提交于 2020-01-14 08:55:50
问题 Im needing the natural logarithm function for use in a .cpp (c++) source file. Now, of course I can do this with a quick google search and a simple library solution. But Im a bit confused... On the cplusplus dot com website under reference/cmath/log/ they have an example of how to use the log function, as follows /* log example */ #include <stdio.h> /* printf */ #include <math.h> /* log */ int main () { double param, result; param = 5.5; result = log (param); printf ("log(%f) = %f\n", param,