⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loglevel.java

📁 一个实用工具类
💻 JAVA
字号:
/* * Copyright (C) butor.com. All rights reserved. * * This software is published under the terms of the GNU Library General * Public License (GNU LGPL), a copy of which has been included with this * distribution in the LICENSE.txt file.  */package org.butor.log.service;import org.butor.bls.BeanServiceUtil;import org.butor.bls.IOutputResponse;import org.butor.bls.IRequest;import org.butor.bls.Service;import org.butor.bls.ServiceException;import org.butor.dataStruct.Message;import org.butor.log.Log;import org.butor.log.service.bean.LogLevelParam;/** * change log level for a class or package. *  * @author sawanai * Jul 5, 2004 */public class LogLevel extends Service {	/**	 * 	 */	public LogLevel(String appName) {		super(LogLevelParam.RPC_NAME +"-" +appName.toLowerCase());	}		public Class getServiceParamBeanClass() {		return LogLevelParam.class;	}		public String getDescription() {		return "Log level modifier.";	}		public IOutputResponse execute(IRequest request) throws ServiceException {		IOutputResponse response = request.createResponse();				LogLevelParam params = new LogLevelParam();		BeanServiceUtil.populateParamBean(params,request);		int stat = 0;		String msg = null;				// -------------------		String className = params.getClassName(); 		String levelName =  params.getLevelName();		int logLevel = Log.getLogLevel(levelName);		if (!Log.isLogLevelValid(logLevel)) {			stat = 1000;			msg = "Log level not valid! level=[" +levelName+"]"; 			Log.logStr(this, Log.LOG_TYPE_ERROR, "execute()", msg);			response.addMessage(new Message(stat, Message.ERROR, msg));			response.endResponse(stat);			return response;		}				stat = 0;		Log.setLogLevel(className, levelName);		msg = "Log level set to class=[" +className +"], level=[" +levelName +"]."; 		Log.logStr(this, Log.LOG_TYPE_INFO, "execute()", msg);		response.addMessage(new Message(stat, Message.INFO, msg));		response.endResponse(stat);		return response;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -