📄 clientloggerthread.java
字号:
/**
* $Log: ClientLoggerThread.java,v $
* Revision 1.2 2003/02/01 16:28:46 willaxt
* removed unneccessary static fields
*
* Revision 1.1 2003/01/16 13:11:41 mwulff
* initial version
*
* Revision 1.4 2002/12/20 18:51:18 mwulff
* no message
*
* Revision 1.3 2002/12/14 22:43:08 mwulff
* no message
*
* Revision 1.2 2002/12/13 20:07:42 mwulff
* no message
*
* Revision 1.1 2002/12/09 18:05:25 mwulff
* initial version
*
*/
package de.fhm.jkf.comm.sv;
import java.util.Vector;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.spi.LoggingEvent;
import de.fhm.jkf.resource.sv.RemoteManager;
/**
* @author marten wulff
*
* * <br><br><center><table border="1" width="80%"><hr>
* <strong><a href="http://jkf.sourceforge.net">The JKF Project</a></strong>
* <p>
* Copyright (C) 2002 by Marten Wulff
* <p>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* <p>
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* <p>
* You should have received a copy of the <a href="http://www.gnu.org/copyleft/lesser.html">
* GNU Lesser General Public License</a> along with this library; if not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
* <hr></table></center>
*/
class ClientLoggerThread extends Thread {
// Logging
private Logger logger = Logger.getLogger(ClientLoggerThread.class);
private static final String THREAD_NAME = "JKFClientLoggerThread";
private Vector logMessages = null;
private Logger loggerToUse = null;
ClientLoggerThread(Vector logMessages, Logger loggerToUse) {
super(THREAD_NAME);
this.logMessages = logMessages;
this.loggerToUse = loggerToUse;
}
/**
* Run method for handling client log messages.
* It's ensured, that only LoggingEvents are logged,
* which Level is greater or equal to the Level of
* the Logger which is responsible for logging
* client messages.
*/
public void run() {
if(logger.isDebugEnabled()) {
logger.debug("Starting client logging ...");
}
// iterate over the buffer that contains the remote
// LoggingEvents and check if the level of the
// remote LoggingEvent is greater or equals to
// current remote log level.
LoggingEvent ev = null;
Level clientLogLevel = RemoteManager.instance().getClientLogLevel();
for (int i = 0; i < logMessages.size(); i++) {
ev = (LoggingEvent) logMessages.elementAt(i);
if (ev.getLevel().isGreaterOrEqual(clientLogLevel)) {
loggerToUse.callAppenders(ev);
}
}
if(logger.isDebugEnabled()) {
logger.debug("Finished client logging ...");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -