季浩的Blog
努力
BlogJava
首頁
新隨筆
聯系
聚合
管理
隨筆-46 評論-64 文章-2 trackbacks-0
如何使用log4j 運行時更改配置
可以用下面這個方法來做到
import
?org.apache.log4j.Logger;
import
?org.apache.log4j.PropertyConfigurator;
public
?
class
?DemoRunTimeChangeLog4J?
{
?
private
?
static
?
final
?Logger?logger?
=
?Logger.getLogger(DemoRunTimeChangeLog4J.
class
);
?
public
?
static
?
void
?main(String[]?args)?
{
??
PropertyConfigurator.configureAndWatch(
"
src/log4j.configureAndWatch
"
,
60000
);
??
??
while
?(
true
)?
{
???
if
?(logger.isDebugEnabled())?
{
????logger.debug(
"
DEBUG?MESSAGE
"
);
???}
???logger.info(
"
Info?Message
"
);
???
try
?
{
????Thread.sleep(
5000
);
???}
?
catch
?(InterruptedException?e)?
{
???}
??}
?}
}
posted on 2008-09-03 17:35
jht
閱讀(637)
評論(0)
編輯
收藏
所屬分類:
J2SE
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
支持運行時修改配置的系統Prototype
如何使用log4j 運行時更改配置
數獨游戲小程序
new & valueof & 直接賦值的區別
截圖程序 MyScreenSnap Version 2.0
使用Eclipse做Java開發時,JDK1.6居然也不認識enum?
[轉載]用Swing編寫反應靈敏的圖形用戶界面
[翻譯]Java RMI指南
使用WebService 和RMI遠程協作
MyScreenSnap 一個簡單的截圖程序
讀書:
《JAVA與模式》閻宏
《精通正則表達式》
《Perl語言入門》
《J2EE Development without EJB》
BlogJava-季浩的Blog
100.0%男性傾向,0.0%女性傾向
評點:您的文風冷靜而鎮定,言語間展現出強悍的思辨能力與恢宏的胸襟,一個男子漢的陽剛形象躍然紙上。
yodao
|
博客男女
很不錯的網站,在線沖手機費
<
2008年9月
>
日
一
二
三
四
五
六
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
11
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(2)
給我留言
查看公開留言
查看私人留言
隨筆分類
DWR(2)
Eclipse(2)
Groovy&Grails(1)
GWT(1)
Hibernate(1)
J2EE(7)
J2ME(4)
J2SE(14)
OSGI(2)
Pattern
Spring
Struts1(1)
Struts2(2)
Swing Tips(5)
數獨程序(1)
隨筆檔案
2008年9月 (7)
2008年8月 (3)
2008年7月 (3)
2008年5月 (2)
2008年4月 (1)
2008年3月 (1)
2008年1月 (2)
2007年11月 (2)
2007年10月 (2)
2007年9月 (4)
2007年8月 (1)
2007年7月 (2)
2007年5月 (1)
2007年3月 (4)
2007年1月 (4)
2006年12月 (3)
2006年3月 (1)
2006年2月 (2)
文章檔案
2008年7月 (1)
2008年4月 (1)
我的BLOG
我的.NET和其他相關主題Blog
我的C/C++博客
搜索
積分與排名
積分 - 104143
排名 - 560
最新評論
1.?re: 使用JSON和AJAX創建網站的標簽云(TagCloud)
頂
--fffr
2.?re: Q:為什么透明的PNG格式圖片在網頁里顯示的時候不是透明的?
因為你的網頁背景
--shndpz
3.?re: 使用WebService 和RMI遠程協作
實現類沒有找到
--11
4.?re: Groovy Plugin for Eclipse IDE
安裝后,新建菜單里看不到Groovy Project的選項?
--雷納德
5.?re: Q: response.setHeader("Cache-Control","no-cache"); 是干什么用的?目的是什么?
我個人認為是不緩存或者保存你這次返回的信息,
比如我們在網頁上生成圖片,但不希望這些圖片一直占據內存,就可以使用這個策略吧。
--kaki
閱讀排行榜
1.?Unable to load bean org.apache.struts2.dispatcher.multipart.MultiPartRequest (jakarta) - [unknown location](17171)
2.?Q: response.setHeader("Cache-Control","no-cache"); 是干什么用的?目的是什么?(16594)
3.?[JSP] The function *** cannot be located with the specified prefix(7771)
4.?[DWR]Max depth exceeded when dereferencing(4221)
5.?[DWR] --Erroring: batchId[1] message[org.directwebremoting.extend.MarshallException: Error marshalling ...(4205)
評論排行榜
1.?Unable to load bean org.apache.struts2.dispatcher.multipart.MultiPartRequest (jakarta) - [unknown location](11)
2.?設計模式學習(一) 工廠模式之簡單工廠(7)
3.?[DWR]Max depth exceeded when dereferencing(5)
4.?MyScreenSnap 一個簡單的截圖程序(5)
5.?[DWR] --Erroring: batchId[1] message[org.directwebremoting.extend.MarshallException: Error marshalling ...(4)
Powered by:
博客園
模板提供:
滬江博客
Copyright ©2025 jht
主站蜘蛛池模板:
涟源市
|
白沙
|
晋宁县
|
三原县
|
新密市
|
保定市
|
朝阳县
|
栾川县
|
长乐市
|
泗水县
|
冷水江市
|
平邑县
|
绥化市
|
望奎县
|
扎鲁特旗
|
巴林右旗
|
喀什市
|
西昌市
|
沙河市
|
长顺县
|
福鼎市
|
泊头市
|
和平县
|
亳州市
|
喜德县
|
扶余县
|
河津市
|
南部县
|
徐州市
|
丹凤县
|
洞头县
|
金沙县
|
金秀
|
新沂市
|
丹江口市
|
噶尔县
|
本溪
|
班玛县
|
策勒县
|
庆阳市
|
百色市
|