/********************************************************************
* Final Update Date: $Date: 2005/11/16 05:48:47 $ [$Revision: 1.11 $]
* Last updated by: $Author: lhj_kk$
* Copyright (c) 2004-2006 NNN ATA CORPORATION, All rights reserved.
********************************************************************/
Package jp.co.**.**.core.logging;
Import jp.co.**.**.core.constants.baseconstant;
Import Org.apache.log4j.Category;
Import Org.apache.log4j.PropertyConfigurator;
/**
*ログマネジャクラス<br>
* machine は below り<br>
* <ul>
* <li> static method でインスタンスを Aimi installed する
* <li>ログインスタンスの get
* </ul>
* <br>
* @since 1.0.0
* @version <br>1.0.0 new 2005/09/30
* @author lhj
*/
public class Categorymanage implements Baseconstant {
/**
*カテゴリーインスタンス
*/
private static Category Category = null;
/**
static method でインスタンスを Aimi Install する
* log4j.properties
*/
static {
try {
system.out.println ("Log4jログマネージャ initial メッソド");
propertyconfigurator.configureandwatch (Log4jfile);
} catch (Exception e) {
e.printstacktrace ();
&NBSP;&NBSP}
}
/**
*ログインスタンスの obtained
* @param thisclassカテゴリーのキー
* @return categoryカテゴリー
*/
public static synchronized Category getinstance (String thisclass) {
20051103 UC. UP-1 Land-yu fixed STA
if (! Serverlog.equals (ThisClass)) {
ThisClass = Serverlog;
}
if (category = = null) {
Category = Category.getinstance (ThisClass);
}
20051103 UC. UP-1 Land-yu correction end
return category;
}
}
2.
Package jp.co.nec.inf.frw.log;
Import Java.net.URL;
Import jp.co.nec.inf.frw.com.FrwCst;
Import Org.apache.log4j.Logger;
Import Org.apache.log4j.PropertyConfigurator;
Import Org.apache.log4j.xml.DOMConfigurator;
public class Frwadapterlog implements Frwlog {
public static final String xml_file_extension = ". XML";
static{
Log4j of the initial stage
URL url = FrwAdapterLog.class.getClassLoader (). getresource (frwcst.log4jfile_location);
if (FrwCst.LOG4JFILE_LOCATION.toLowerCase (). EndsWith (xml_file_extension)) {
Domconfigurator.configure (URL);
}
else {
Propertyconfigurator.configure (URL);
}
if (URL!= null) {
Domconfigurator.configure (URL);
} else {
Domconfigurator.configure (System.getproperty ("Log4j.configuration", "Log4j.xml"));
// }
}
/**
*ロギング Ontology
*/
Private Org.apache.log4j.Logger Logger;
/**
*コンストラクタ
*
* @param clsログを Output するクラス
*/
Protected Frwadapterlog (Class CLS) {
Logger = Logger.getlogger (CLS);
}
/**
* Specify されたクラスでロギングを initial します.
*
* @param clsログを Output するクラス
*/
public static Frwlog getinstance (Class cls) {
Frwadapterlog wrapper = new Frwadapterlog (CLS);
return wrapper;
}
/**
*ログクラスを placed Earpick straight する.
*
* @param clsログクラス
*/
public void Resetlogger (Class cls) {
Logger = Org.apache.log4j.Logger.getLogger (CLS);
}
public void Debug (String message, throwable cause) {
Logger.debug (Message,cause);
}
public void error (String message, throwable cause) {
Logger.error (Message,cause);
}
public void info (String message, throwable cause) {
Logger.info (Message,cause);
}
public void warn (String message, throwable cause) {
Logger.warn (Message,cause);
}
public void Debug (String message) {
Logger.debug (message);
}
public void info (String message) {
Logger.info (message);
}
public void warn (String message) {
Logger.warn (message);
}
public void error (String message) {
Logger.error (message);
}
}