logging

Log to database instead of log files

烂漫一生 提交于 2019-12-29 02:21:06
问题 I'm interested in sending all Rails application logging to a database (MySQL or MongoDB) either in addition to or instead of to a log file. There are a few reasons, most of which are concerned about log file analysis. We already use Google Analytics, but there are a variety of things we want to do that aren't as workable in Analytics. Furthermore, I'd like to do "real time" investigation of issues by looking at logs. Sifting through a log file is a tedious way to do that, and I'd like to do

Implementation and usage of logger wrapper for log4net

旧城冷巷雨未停 提交于 2019-12-28 18:11:55
问题 This question is related to Steven’s answer - here. He proposed a very good logger wrapper. I will paste his code below: public interface ILogger { void Log(LogEntry entry); } public static class LoggerExtensions { public static void Log(this ILogger logger, string message) { logger.Log(new LogEntry(LoggingEventType.Information, message, null)); } public static void Log(this ILogger logger, Exception exception) { logger.Log(new LogEntry(LoggingEventType.Error, exception.Message, exception));

JNA Event Log Reader

两盒软妹~` 提交于 2019-12-28 16:16:12
问题 I am using the below code to read through the Windows Application Event Log using JNA. I want to be able to specify which event to start at instead of always starting with the first event. Does anyone have any suggestions? import java.io.IOException; import com.sun.jna.*; import com.sun.jna.platform.win32.*; import com.sun.jna.platform.win32.WinNT.*; import com.sun.jna.ptr.IntByReference; public class test { public static void main(String[] args) throws NumberFormatException, IOException {

Log.d and impact on performance

。_饼干妹妹 提交于 2019-12-28 14:05:10
问题 I'm not entirely sure about what I'm reading in the documentation. Is it ok to leave a bunch of log.d pieces of code scattered about, or should I comment them out so that they don't impact my app's performance. Thanks, I'm a little confused because if you read about the log object (documentation) you see this: "The order in terms of verbosity, from least to most is ERROR, WARN, INFO, DEBUG, VERBOSE. Verbose should never be compiled into an application except during development. Debug logs are

Where does system.out.println print from a JSP?

巧了我就是萌 提交于 2019-12-28 13:55:29
问题 Where does tomcat put the System.out.println output ? I'm not interested in out.println . I'm using a system that uses system.out to log issues, like login success/fail, and I need to look to that generated "log". 回答1: It usually prints to catalina.out. It is highly unrecommended to log using system.out.println() from several reasons: you cannot control which messages are logged and which aren't unless you change the code catalina.out just grow all the time, and you cannot move it so that

Log4j failing to send an email when logging an error

自古美人都是妖i 提交于 2019-12-28 13:53:08
问题 I enabled logging in my application, and I want to send logs error by email (gmail account). I: Set up a java project add activation.jar , log4j.java and mail.jar (java mail) I added those libraries to the project class path I added log4j.properties and I configured it like this : log4j.rootLogger= mainlogger, Email, dest log4j.appender.mainlogger=org.apache.log4j.ConsoleAppender log4j.appender.mainlogger.target=System.out log4j.appender.mainlogger.layout=org.apache.log4j.PatternLayout log4j

How can I configure log4j to not print the exception stacktrace?

只谈情不闲聊 提交于 2019-12-28 13:02:27
问题 We use Log4j (and Commons Logging) to log our error messages. Now we want to set up an additional log appender that outputs fatal errors to syslog, but without the exceptionally long Java stacktraces (those will still be available in the full log file). How would one configure this (using log4j.xml)? Is there a filter available to ignore the stack traces? 回答1: Edit after reading some more of the source: You still need to subclass PatternLayout, but the method you want to override is

log4j log file names?

℡╲_俬逩灬. 提交于 2019-12-28 12:44:43
问题 We have several jobs that run concurrently that have to use the same config info for log4j. They are all dumping the logs into one file using the same appender. Is there a way to have each job dynamically name its log file so they stay seperate? Thanks Tom 回答1: Can you pass a Java system property for each job? If so, you can parameterize like this: java -Dmy_var=somevalue my.job.Classname And then in your log4j.properties: log4j.appender.A.File=${my_var}/A.log You could populate the Java

JSF2 logs with tomcat

女生的网名这么多〃 提交于 2019-12-28 12:09:32
问题 I'm having a project using JSF2 (2.1.2), Richfaces4 (4.0.0.Final) on tomcat6 (6.0.28). In order to manage portability between Tomcat and WebSphere7 for my EARs, I have the following jars inside my tomcat lib: el-api-2.2.jar, jsf-api-2.1.2.jar, jsf-impl-2.1.2.jar, validation-api-1.0.0.GA.jar. My problem is that I never managed to change the log levels of JSF or Richfaces and except from the initialization ones, I don't see any inside my console. Even when I get exceptions in my server response

SQL query logging for SQLite?

孤人 提交于 2019-12-28 12:02:46
问题 I need to log queries, not only inserts/updates/deletes but also selects and other queries, from a number of applications that use SQLite. Introducing logging to the applications would in this case not be a feasible solution in practice. So how can I enable query logging in SQLite itself? 回答1: Take a look at the sqlite Trace API. You have to implement the callback yourself. void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); The callback function registered by sqlite3