logging

How to filter sensitive information when logging with Sinatra and Rack Logger

落花浮王杯 提交于 2020-07-30 05:53:22
问题 I maintain a Sinatra app that acts as a JSON API service. The API is consumed by another web app, as well as a mobile app. I'd like to have Rack::CommonLogger exclude sensitive information, like a password, from its logs. Rails has this setting enabled, but I have found no documentation how to do this in Sinatra. 回答1: You can try to intercept the call to write and filter out sensitive messages like so : logger = Logger.new("my_common.log") logger.instance_eval do def write(msg) self.send(:<<,

How to filter sensitive information when logging with Sinatra and Rack Logger

余生长醉 提交于 2020-07-30 05:52:20
问题 I maintain a Sinatra app that acts as a JSON API service. The API is consumed by another web app, as well as a mobile app. I'd like to have Rack::CommonLogger exclude sensitive information, like a password, from its logs. Rails has this setting enabled, but I have found no documentation how to do this in Sinatra. 回答1: You can try to intercept the call to write and filter out sensitive messages like so : logger = Logger.new("my_common.log") logger.instance_eval do def write(msg) self.send(:<<,

Enlarge Linux Kernel Log Buffer more that 2M

孤街醉人 提交于 2020-07-28 16:53:16
问题 I am in the process of collecting some sort of Linux Kernel activities. I have placed multiple printk statements with in the kernel source code and would like to monitor those during regular kernel activities. Unfortunately, I have realized that the Kernel Log Buffer size ( CONFIG_LOG_BUF_SHIFT ) cannot be more that 2^21 which is essentially equal to 2M entries. Is there any other way to record more than 2M Kernel messages ? 回答1: You can set the kernel log buffer to log_buf_len=4M in your

Enlarge Linux Kernel Log Buffer more that 2M

放肆的年华 提交于 2020-07-28 16:51:57
问题 I am in the process of collecting some sort of Linux Kernel activities. I have placed multiple printk statements with in the kernel source code and would like to monitor those during regular kernel activities. Unfortunately, I have realized that the Kernel Log Buffer size ( CONFIG_LOG_BUF_SHIFT ) cannot be more that 2^21 which is essentially equal to 2M entries. Is there any other way to record more than 2M Kernel messages ? 回答1: You can set the kernel log buffer to log_buf_len=4M in your

How to convert django.request logger time to UTC?

家住魔仙堡 提交于 2020-07-23 06:54:09
问题 I have an application in another TIME_ZONE , but I want to keep all generated logs in UTC. I already defined my own Formatter for Python logging, and all logger calls that I have throughout the app, are all using UTC, but django.request logs, are still using locale's app timezone (both logs bellow, were generated by a single request): Django Request Logger: [10/Jun/2020 16:59:52] "POST /api/v1/report/ HTTP/1.1" 200 761 Application Logger: [10/Jun/2020 23:00:02] INFO - REPORT_OK {'country':

How to convert django.request logger time to UTC?

孤人 提交于 2020-07-23 06:53:06
问题 I have an application in another TIME_ZONE , but I want to keep all generated logs in UTC. I already defined my own Formatter for Python logging, and all logger calls that I have throughout the app, are all using UTC, but django.request logs, are still using locale's app timezone (both logs bellow, were generated by a single request): Django Request Logger: [10/Jun/2020 16:59:52] "POST /api/v1/report/ HTTP/1.1" 200 761 Application Logger: [10/Jun/2020 23:00:02] INFO - REPORT_OK {'country':

How to convert django.request logger time to UTC?

你。 提交于 2020-07-23 06:52:28
问题 I have an application in another TIME_ZONE , but I want to keep all generated logs in UTC. I already defined my own Formatter for Python logging, and all logger calls that I have throughout the app, are all using UTC, but django.request logs, are still using locale's app timezone (both logs bellow, were generated by a single request): Django Request Logger: [10/Jun/2020 16:59:52] "POST /api/v1/report/ HTTP/1.1" 200 761 Application Logger: [10/Jun/2020 23:00:02] INFO - REPORT_OK {'country':

How to log Unhandled TimeoutError in Winstonjs logger?

限于喜欢 提交于 2020-07-22 22:11:03
问题 I've got a node application in which I use Winstonjs as a logger. In my logger I've got a specific part for logging exceptions like this: const myFormat = winston.format.printf(info => { return `${info.timestamp} ${info.level}: ${info.message}`; }); const logger = winston.createLogger({ level: "debug", format: winston.format.combine(winston.format.timestamp(), myFormat), // winston.format.json(), transports: [ new winston.transports.File({filename: "logs/error.log", level: 'error'}), new

How to log Unhandled TimeoutError in Winstonjs logger?

喜欢而已 提交于 2020-07-22 22:10:56
问题 I've got a node application in which I use Winstonjs as a logger. In my logger I've got a specific part for logging exceptions like this: const myFormat = winston.format.printf(info => { return `${info.timestamp} ${info.level}: ${info.message}`; }); const logger = winston.createLogger({ level: "debug", format: winston.format.combine(winston.format.timestamp(), myFormat), // winston.format.json(), transports: [ new winston.transports.File({filename: "logs/error.log", level: 'error'}), new

all jar files using my log4j. too much information on log file

ぃ、小莉子 提交于 2020-07-22 21:44:08
问题 I started learning log4j. It is awesome. But my project is tooo big. has so many jar files. when I set my log level to DEBUG, all other jar files debug messages are printing in my log file. With in a minute the logfile size increased to 5MB. I want to just display my log messages in my class. How I can do that ? My configuration is as follows log4j.properties # Define the root logger with appender file log = ./logs log4j.rootLogger = DEBUG, FILE # Define the file appender log4j.appender.FILE