logging

Embedded Tomcat logging over logback / sl4j

て烟熏妆下的殇ゞ 提交于 2020-01-01 05:36:07
问题 How can I make an embedded tomcat write its logs over logback? I found some info about using a standalone tomcat with log4j. But how does the setup look like for an embedded tomcat and logback? These are the maven dependencies: <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>${logback.version}</version> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> <version>${tomcat.version}<

How to have Spring boot use a log4j.xml configuration file?

☆樱花仙子☆ 提交于 2020-01-01 05:03:12
问题 I have a simple Spring Boot application that builds to a jar file. I have a log4j.xml file in src/main/resources/log4j.xml that looks like this (basic sample file from the log4j docs): <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="stdout" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.PatternLayout"> <!-- Pattern to output the caller's

Is creating a separate thread for a logger ok?

孤街醉人 提交于 2020-01-01 04:53:08
问题 I'm writing a multithreaded application in Qt (several threads with their own event loops). When logging I want the logger to include a thread id (they have meaningful names) into the log. Qt default logger seems incapable of doing this. So I have three options: every thread does logging by itself (this involves mutexes, so is probably the worst approach, but I'm not sure) There's a dedicated logger thread and other threads directly post events into it (probably faster, than 3.) Same as 2.

Java: How to get a class object of the current class from a static context?

北城余情 提交于 2020-01-01 04:39:07
问题 I have a logging function that takes the calling object as a parameter. I then call getClass().getSimpleName() on it so that I can easily get the class name to add to my log entry for easy reference. The problem is that when I call my log function from a static method, I can't pass in "this". My log function looks something like this: public static void log(Object o, String msg){ do_log(o.getClass().getSimpleName()+" "+msg); } public void do_something(){ log(this, "Some message"); } But let's

JDK: how to enable PlatformLogger programmatically

廉价感情. 提交于 2020-01-01 04:33:10
问题 I need to enable logging for some JDK7 internal class programmatically. This is what I do in the initialization of my application: httpLogger = Logger.getLogger("sun.net.www.protocol.http.HttpURLConnection"); httpLogger.setLevel(Level.FINEST); where httpLogger is a strong reference (in order to avoid the logger being garbage collected). I also set the level of the ConsoleHandler to ALL. However I cannot get any output. If I do it via logging configuration file it works as expected. I may be

Simple C++ logger by using singleton pattern

 ̄綄美尐妖づ 提交于 2020-01-01 03:16:08
问题 Due to the flooding examples of implementing logger using Singleton pattern, I have just written a simple C++ logger in the same approach for my program. However, since the famous double-checked locking approach is known to be no more thread-safe, I wonder if I should: 1) Forget about the use of Singleton pattern in this case? 2) Continue to use double-checked locking even though it is unsafe? 3) Use the expensive pure sync lock method for every access to its public interfaces? Any

extracting error information from rails log files

房东的猫 提交于 2020-01-01 03:09:09
问题 i am developing on 5 different rails projects, plus also refactoring some (moving from older rails versions to 2.3) - what is the best way to extract the error information from the logfiles, so i can see all the depreciation warnings, runtime errors and so on, so i can work on improving the codebase? are there any services or libraries out there you can recommend, that actually help with rails logfile parsing? 回答1: Read about grep linux command. http://www.cyberciti.biz/faq/howto-use-grep

How do you implement audit trail for your objects (Programming)?

*爱你&永不变心* 提交于 2020-01-01 02:44:13
问题 I need to implement an audit trail for Add/Edit/Delete on my objects,I'm using an ORM (XPO) for defining my objects etc. I implemented an audit trail object that is triggered on OnSaving OnDeleting Of the base object, and I store the changes in Audit-AuditTrail (Mast-Det) table, for field changes. etc. using some method services called. How do you implement audit trail in you OOP code? Please share your insights? Any patterns etc? Best practices etc? Another thing is that how to disable audit

Storage of many log files

北城以北 提交于 2020-01-01 02:40:14
问题 I have a system which is receiving log files from different places through http (>10k producers, 10 logs per day, ~100 lines of text each). I would like to store them to be able to compute misc. statistics over them nightly , export them (ordered by date of arrival or first line content) ... My question is : what's the best way to store them ? Flat text files (with proper locking), one file per uploaded file, one directory per day/producer Flat text files, one (big) file per day for all

Python Logger logging things twice to console

邮差的信 提交于 2020-01-01 02:08:07
问题 I'm trying to put together a logger using Python. I'm working in 2.6 so I can't use the new dictionary style method and instead am going with the good old fashioned config file. The problem is, stuff outputs twice to the console and I can't understand why. Here's my test script: import logging import logging.config if __name__ == "__main__": logging.config.fileConfig("newSlogger.conf") slogger = logging.getLogger("sloggerMain") slogger.debug("dbg msg") slogger.info("herp derp dominae") Here's