在java日志框架场景中寻找方法 [英] Find a way in the java logging frameworks scene

查看:20
本文介绍了在java日志框架场景中寻找方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java 有很多框架/API 可以帮助您在应用程序中进行日志记录:

Java has a lot of frameworks / APIs that help you do logging in your application:

  1. Java API 具有 java.util.logging 包.
  2. Apache 的 Log4j.
  3. Apache 的公共日志记录.
  4. SLF4J(登录 Facade).
  5. jLo.还有更多……

我一直使用 log4j 库,我发现它在大多数情况下已经足够了,并且在我需要更多控制时可以扩展.

I've always used the log4j library, i found it sufficient most of the time, and extensible when i needed more control.

谁有使用过一个以上框架的经验,可以分享他的经验吗?从应用程序架构的角度来看,什么时候使用一个框架比另一个更好?为什么我更喜欢一个?

Anyone who had experience with more than one framework can share his experience? when is it better to use one framework over the other and from application architecture point of view? Why would i prefer one over other?

谢谢

推荐答案

这个问题似乎和 354837.

简单的答案是,如果您正在编写一个可能会放入您无法控制日志记录的应用程序中的库,那么您会选择 Commons Logging,如果不能,则选择其他选择之一.我个人在所有情况下都使用 CL,只是因为它很常见——我不需要记住框架之间的差异.

The simple answer is that you'd go for Commons Logging if you're writing a library that may be dropped into applications where you have no control over the logging, one of the other choices if not. I personally use CL in all cases, simply because it's common -- I don't need to remember the differences between frameworks.

这篇关于在java日志框架场景中寻找方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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