logging

how to customize “TimeStamp” format of Boost.Log

邮差的信 提交于 2020-01-02 00:54:09
问题 I want to get year-month-day hour:minute:second.fraction(2 digits), if I use "%Y-%m-%d %H:%M:%S.%f", I got almost what I want exception for the fraction( last part ) of seconds, it's showing 6 digits on my Windows XP, I don't know how to get 2 digits only, any idea? 回答1: Boost.DateTime (upon which Boost.Log relies) doesn't seem to support specialized fractional seconds formatting, so the only way to do that would be to write your own custom attribute formatter, or (the easier, but less nice

Log4Net Multiple loggers

你说的曾经没有我的故事 提交于 2020-01-02 00:43:32
问题 First of all, I have seen a lot of answers and tips in others topics (most similar: Log4Net: Multiple loggers), but there is no applicable answer. I want to have 2 loggers with different file appenders and restrict each to write into root logger. It is Console app. Whole code below: using System; using System.Diagnostics; using System.Linq; using log4net; namespace Test_log4net { class Program { static void Main(string[] args) { log4net.Config.XmlConfigurator.Configure(); ILog logger =

Log4Net Multiple loggers

偶尔善良 提交于 2020-01-02 00:43:28
问题 First of all, I have seen a lot of answers and tips in others topics (most similar: Log4Net: Multiple loggers), but there is no applicable answer. I want to have 2 loggers with different file appenders and restrict each to write into root logger. It is Console app. Whole code below: using System; using System.Diagnostics; using System.Linq; using log4net; namespace Test_log4net { class Program { static void Main(string[] args) { log4net.Config.XmlConfigurator.Configure(); ILog logger =

What is in android.util.Log#println_native()?

江枫思渺然 提交于 2020-01-01 19:33:15
问题 Here is the android.util.Log source code. At the very bottom (line 340), what is in the method: public static native int println_native(int bufID, int priority, String tag, String msg); i guess println_native() is more or less like its println() , just with an int bufID different. But even i got the codes of println_native() , i still lack com.android.internal.os.RuntimeInit (line 19, the import ) to simulate android.util.Log in old Android version. 回答1: Just did some digging in the android

Add file logging dynamically at runtime with Log4j2 2.8.1

丶灬走出姿态 提交于 2020-01-01 19:06:10
问题 I am in need of adding programmatically a file logging, with file name generated dynamically. My code is like this: private static final Logger LOGGER = LogManager.getLogger(Archiver.class); public static void openLogfile(String folder) { String dateTime = "TODO"; String fileName = folder + "upload" + dateTime + ".log"; LOGGER.info("Opening " + fileName + " for logging."); // setting up a FileAppender dynamically... final LoggerContext ctx = (LoggerContext) LogManager.getContext(false); final

Python logging: different behavior between using fileconfig and programmatic config

久未见 提交于 2020-01-01 18:59:19
问题 I just discovered a different behavior of Python logging, depending on if I use logging with fileconfig and logging with programmatic config. To demonstrate, I created two minimal examples. In the first example I'm configuring logging programmatically. This example works as expected - the debug log message is printed to the console. # foo.py import logging logger = logging.getLogger(__name__) class Foo(object): def __init__(self): logger.debug('debug log from Foo') ###########################

Get zipped TFS 2015 (vNext) build output logs through powershell (just like the download link after the build)

末鹿安然 提交于 2020-01-01 18:41:13
问题 I'm wondering if anyone has a PowerShell script to either download all the current build logs for this build id (up to the current step) through the Rest API for TFS 2015 (vNext), create separate text files for each logged build step, and zip all the text files? Or, if there is already a way to get a download URL to do what the "Download all logs as zip" link already does (after a build), how can I get it in a PowerShell script? I can probably do this myself given a little time, but I thought

Kibana - How to extract fields from existing Kubernetes logs

纵饮孤独 提交于 2020-01-01 18:19:06
问题 I have a sort of ELK stack, with fluentd instead of logstash, running as a DaemonSet on a Kubernetes cluster and sending all logs from all containers, in logstash format, to an Elasticsearch server. Out of the many containers running on the Kubernetes cluster some are nginx containers which output logs of the following format: 121.29.251.188 - [16/Feb/2017:09:31:35 +0000] host="subdomain.site.com" req="GET /data/schedule/update?date=2017-03-01&type=monthly&blocked=0 HTTP/1.1" status=200 body

Guice log4j custom injection does not support logging within the constructor

点点圈 提交于 2020-01-01 17:26:37
问题 I'm trying to use Guice to inject Log4J Logger instances into classes as described in the Guice documentation: http://code.google.com/p/google-guice/wiki/CustomInjections However, as noted in some of the comments on that wiki page, this scheme does not support a constructor injection. So I can't do this: public class Foo { @InjectLogger Logger logger; @Inject public Foo(<injected parameters>) { logger.info("this won't work because logger hasn't been injected yet"); ... } public bar() { logger

Guice log4j custom injection does not support logging within the constructor

你离开我真会死。 提交于 2020-01-01 17:26:13
问题 I'm trying to use Guice to inject Log4J Logger instances into classes as described in the Guice documentation: http://code.google.com/p/google-guice/wiki/CustomInjections However, as noted in some of the comments on that wiki page, this scheme does not support a constructor injection. So I can't do this: public class Foo { @InjectLogger Logger logger; @Inject public Foo(<injected parameters>) { logger.info("this won't work because logger hasn't been injected yet"); ... } public bar() { logger