logging

tail command showing log file contents in non-real time

丶灬走出姿态 提交于 2020-01-06 08:39:51
问题 I have a C++ application (on Solaris 10) that shows log output based on the time chronological transactions. For example, before establishing a connection to Database server, it prints in stdout as: "Connecting to DB" and after the call to connect, if successful, says "Connected to DB", if failed, says, "failed to connect to DB" and so on. Now, when the application is run, the output (stdout) gets redirected to a log file as below: appl > app.log And, on another session, to see what's going

MDC to differentiate logging between modules

淺唱寂寞╮ 提交于 2020-01-06 08:22:33
问题 My software uses a Service Oriented Architecture (SOA). All the services (lets call them modules for simplicity) writes to a single log file. I would like to distinguish logging between modules. Below is how I would like my log message to look like. [MODULE-1] INFO - This is a test log message from MODULE ONE [MODULE-2] INFO - This is a test log message from MODULE TWO The advantage I see doing this is I would be able to grep necessary information while 'tail-ing' the logs. Also, while

Parsing log lines using awk

戏子无情 提交于 2020-01-06 08:07:08
问题 I have to parse some information out of big log file lines. Its something like abc.log:2012-03-03 11:12:12,457 ABC[123.RPH.-101] XYZ: Query=get_data @a=0,@b=1 Rows=10Time=100 There are many log lines like above in the logfiles. I need to extract information like datetime i.e. 2012-03-03 11:12:12,457 job details i.e. 123.RPH.-101 Query i.e. get_data (no parameters) Rows i.e. 10 Time i.e. 100 So output should look like 2012-03-03 11:12:12,457|123|-101|get_data|10|100 I have tried various

Setting the name of a log4net logger

早过忘川 提交于 2020-01-06 07:22:27
问题 I am using the Castle logging facility with log4net in my application (MVC3 web app). However, rather than using the ILogger interface directly I have abstracted this by creating another interface (IAuditor) with a concrete implementation Log4NetAuditor (see code below). You may ask why I've done this since the point of ILogger is to abstract the underlying logging implementation. I've done because of strict observation of the onion architecture principle of abstracting all infrastructure

Gunicorn gevent worker logging issues

亡梦爱人 提交于 2020-01-06 07:21:42
问题 I have a gunicorn server running with 1 worker. I user the logging module during the request. None of them appear in stdout. I know that gevent workers monkey patch all so I would assume any loggin done during the request should appear on the mainthread stdout. The app parse to gunicorn is the application wsgi from django. gunicorn -c gunicorn.py core.wsgi:application In gunicorn.py I have: bind = '0.0.0.0:8080' backlog = 2048 workers = 1 worker_class = 'gevent' worker_connections = 1000

Gunicorn gevent worker logging issues

a 夏天 提交于 2020-01-06 07:20:06
问题 I have a gunicorn server running with 1 worker. I user the logging module during the request. None of them appear in stdout. I know that gevent workers monkey patch all so I would assume any loggin done during the request should appear on the mainthread stdout. The app parse to gunicorn is the application wsgi from django. gunicorn -c gunicorn.py core.wsgi:application In gunicorn.py I have: bind = '0.0.0.0:8080' backlog = 2048 workers = 1 worker_class = 'gevent' worker_connections = 1000

Python 2 logger repeats lines after use of default logger

百般思念 提交于 2020-01-06 06:52:22
问题 I am working on a piece of code which instantiates its own logger with its own handlers and format. Now I've added a use of a library which uses the logging module directly and it screws up my logger - The original logger starts printing each line twice in different formats while the default logger prints nothing at all. Any suggestions? MCVE: import sys import logging log = logging.getLogger('foo') log.addHandler(logging.StreamHandler(sys.stdout)) log.setLevel(logging.DEBUG) log.info("works

Python 2 logger repeats lines after use of default logger

二次信任 提交于 2020-01-06 06:51:44
问题 I am working on a piece of code which instantiates its own logger with its own handlers and format. Now I've added a use of a library which uses the logging module directly and it screws up my logger - The original logger starts printing each line twice in different formats while the default logger prints nothing at all. Any suggestions? MCVE: import sys import logging log = logging.getLogger('foo') log.addHandler(logging.StreamHandler(sys.stdout)) log.setLevel(logging.DEBUG) log.info("works

print - Background or main thread operation

大城市里の小女人 提交于 2020-01-06 06:01:06
问题 This might sound quite basic and stupid but it has been bothering me for a while. How can print be classified in terms of operation - main or background ? As a small test, on putting print in a background task - web service call : Webservice().loadHeadlinesForSource(source: source) { headlines in print("background print") self.headlineViewModels = headlines.map(HeadlineViewModel.init) DispatchQueue.main.async { print("main thread print") completion() } } Both the print statements get printed.

GWT log file when deployed

不打扰是莪最后的温柔 提交于 2020-01-06 05:49:27
问题 i have a GWT web application project and i will deploy it to Tomcat . before deploying it, i want to set a log file so that i can trace if some errors occur like JavaScriptException . how can i do this? as i did some research, i've read that GWT's default logging does not emulate the FileHandler that allow me write my log file to a specific file. Then from some forums about logging, someone has been using log4j but log4j is for Java (am i right?). how can i do the logging for my GWT app? 回答1: