一个很好的Java数据库日志追加器? [英] A good database log appender for Java?

查看:249
本文介绍了一个很好的Java数据库日志追加器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的工作场所,我们编写了一个自定义log4j appender,它将日志消息写入数据库(异步使用专用线程,因此没有性能损失)。
我比写日志文件更喜欢它 - 基于数据库的日志更容易查询和分析。

At my workplace, we wrote a custom log4j appender that writes log messages to the database (uses a dedicated thread asynchronously, so no performance hit). I prefer it a lot over writing to log files - a database-based log is much more easy to query and analyze.

是否有开源解决方案这样做(特别是log4j,或任何其他java记录器)?

Is there an open source solution that does this (for log4j specifically, or any other java loggers)?

我们的appender有一些东西,我希望在另一种方法中看到:

Some things that our appender has, and I would like to see in an alternative:


  • 记录异常(呃!)

  • 数据库写入来自单独的线程/池

我们的appender支持以下列,我希望在我们找到的任何解决方案中看到所有这些列。

Our appender supports the following columns, and I would like to see all of them in whatever solution we find.


  • LogId

  • 时间

  • 消息

  • stacktrace

  • 进程ID

  • 主题ID

  • 计算机名称

  • 组件

  • 级别(debug / info / warn /...)

  • ThreadName

  • LogId
  • Time
  • message
  • stacktrace
  • process id
  • thread id
  • machine name
  • component
  • Level (debug/info/warn/...)
  • ThreadName

推荐答案

log4j还提供了一个DBAppender类(log4j需要一组特定的t能够使用此appender进行记录)。
http:// logging .apache.org / log4j / companions / receivers / apidocs / org / apache / log4j / db / DBAppender.html

There is also a DBAppender class provided by log4j (log4j requires a specific set of tables to log using this appender). http://logging.apache.org/log4j/companions/receivers/apidocs/org/apache/log4j/db/DBAppender.html

有一个更新的非Apache您可以在这里找到jdbc记录器:
http://www.dankomannhaupt。 de / projects / index.html

There is an updated non-Apache jdbc logger available here you may also want to try: http://www.dankomannhaupt.de/projects/index.html

这篇关于一个很好的Java数据库日志追加器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆