logging

How can I log all resolve requests to Autofac container?

亡梦爱人 提交于 2020-01-09 06:20:34
问题 I am trying to debug some problems in a legacy code base. I think is being caused by an exception being thrown because something can't be resolved from the Autofac container. However I think the exception is getting buried somewhere and I am not seeing the root cause. I am sure something is being requested from a controller that either can't be found or something that can be found has a dependency that can't be satisfied. There aren't any guard clauses etc. so I think I am getting a null

Python Logging - Disable logging from imported modules

匆匆过客 提交于 2020-01-09 06:07:28
问题 I'm using the Python logging module, and would like to disable log messages printed by the third party modules that I import. For example, I'm using something like the following: logger = logging.getLogger() logger.setLevel(level=logging.DEBUG) fh = logging.StreamHandler() fh_formatter = logging.Formatter('%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s') fh.setFormatter(fh_formatter) logger.addHandler(fh) This prints out my debug messages when I do a logger.debug

Python Logging - Disable logging from imported modules

北城余情 提交于 2020-01-09 06:07:25
问题 I'm using the Python logging module, and would like to disable log messages printed by the third party modules that I import. For example, I'm using something like the following: logger = logging.getLogger() logger.setLevel(level=logging.DEBUG) fh = logging.StreamHandler() fh_formatter = logging.Formatter('%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s') fh.setFormatter(fh_formatter) logger.addHandler(fh) This prints out my debug messages when I do a logger.debug

Python Logging - Disable logging from imported modules

南楼画角 提交于 2020-01-09 06:07:12
问题 I'm using the Python logging module, and would like to disable log messages printed by the third party modules that I import. For example, I'm using something like the following: logger = logging.getLogger() logger.setLevel(level=logging.DEBUG) fh = logging.StreamHandler() fh_formatter = logging.Formatter('%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s') fh.setFormatter(fh_formatter) logger.addHandler(fh) This prints out my debug messages when I do a logger.debug

How to Create a Custom Appender in log4j2?

二次信任 提交于 2020-01-08 11:12:40
问题 As disscussed in this link : How to create a own Appender in log4j? For creating a custom appender in log4j 1.x we have to extend the AppenderSkeleton class and implements its append method. Similarly How we can create a custom appender in log4j2 as we dont have AppenderSkelton class to extend and all other appender extend AppenderBase class . 回答1: This works quite differently in log4j2 than in log4j-1.2. In log4j2, you would create a plugin for this. The manual has an explanation with an

How to Create a Custom Appender in log4j2?

久未见 提交于 2020-01-08 11:11:19
问题 As disscussed in this link : How to create a own Appender in log4j? For creating a custom appender in log4j 1.x we have to extend the AppenderSkeleton class and implements its append method. Similarly How we can create a custom appender in log4j2 as we dont have AppenderSkelton class to extend and all other appender extend AppenderBase class . 回答1: This works quite differently in log4j2 than in log4j-1.2. In log4j2, you would create a plugin for this. The manual has an explanation with an

Get the file name from complete path in log4j2 xml

独自空忆成欢 提交于 2020-01-07 08:35:33
问题 In my log4j2.xml file, I get the complete path of the logfile by passing a system property -Dlogfilename=/home/user/logs/server Log4j2 configuration: <Property name="logFile">${sys:logfilename:-/home/user/logs/server}</Property> As an added requirement, I need to get the name of the log file from the above property and I cannot pass a new system property. How can I get just the name of the file from the complete path? I dont have any experience with XML other than its use for data transport.

Grep multiple strings on large files

你说的曾经没有我的故事 提交于 2020-01-07 05:41:20
问题 I have a large number of large log files (each log file is around 200mb and I have 200GB data in total). Every 10 minutes, server writes to the log file about 10K parameters (with a timestamp). Out of each 10K parameters, I want to extract 100 of them to a new file. First I used grep with 1 parameter, then LC_ALL=C made it a little bit faster, then I used fgrep it was also slightly faster. Then I used parallel parallel -j 2 --pipe --block 20M and finally, for every 200MB, I was able to

How to log everything on the screen to a file?

霸气de小男生 提交于 2020-01-07 05:35:05
问题 I use one rb file with rufus/scheduler on Windows. The script is executed on a comupter start up and it runs in a cmd window. How can I log everything that ruby outputs to the screen to a file? I still want to be able to see the output on the screen. So I want the logging on top of current behaviour. Windows 7 64 bit ruby 1.9.3p194 (2012-04-20) [i386-mingw32] 回答1: If you just want the script to send output to the file instead of the console use IO#reopen to redirect stdout and stderr. def

How can I detect network disconnection in Apache Camel?

会有一股神秘感。 提交于 2020-01-07 05:14:10
问题 I need to log when a client is disconnected from Apache Camel connection. How can I detect a netty-tcp disconnection? from("{{uri.client.address}}") 回答1: Its a bit more complicated to log individual client disconnects but I will try to share what I had to do. You need to extend SimpleChannelInboundHandler with your own class and add the methods needed. For an example class see here: https://github.com/apache/camel/blob/master/components/camel-netty4/src/main/java/org/apache/camel/component