All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.semanticwb.base.util.imp.Logger4jImpl Maven / Gradle / Ivy

The newest version!
/*
 * SemanticWebBuilder es una plataforma para el desarrollo de portales y aplicaciones de integración,
 * colaboración y conocimiento, que gracias al uso de tecnología semántica puede generar contextos de
 * información alrededor de algún tema de interés o bien integrar información y aplicaciones de diferentes
 * fuentes, donde a la información se le asigna un significado, de forma que pueda ser interpretada y
 * procesada por personas y/o sistemas, es una creación original del Fondo de Información y Documentación
 * para la Industria INFOTEC, cuyo registro se encuentra actualmente en trámite.
 *
 * INFOTEC pone a su disposición la herramienta SemanticWebBuilder a través de su licenciamiento abierto al público (‘open source’),
 * en virtud del cual, usted podrá usarlo en las mismas condiciones con que INFOTEC lo ha diseñado y puesto a su disposición;
 * aprender de él; distribuirlo a terceros; acceder a su código fuente y modificarlo, y combinarlo o enlazarlo con otro software,
 * todo ello de conformidad con los términos y condiciones de la LICENCIA ABIERTA AL PÚBLICO que otorga INFOTEC para la utilización
 * del SemanticWebBuilder 4.0.
 *
 * INFOTEC no otorga garantía sobre SemanticWebBuilder, de ninguna especie y naturaleza, ni implícita ni explícita,
 * siendo usted completamente responsable de la utilización que le dé y asumiendo la totalidad de los riesgos que puedan derivar
 * de la misma.
 *
 * Si usted tiene cualquier duda o comentario sobre SemanticWebBuilder, INFOTEC pone a su disposición la siguiente
 * dirección electrónica:
 *  http://www.semanticwebbuilder.org
 */
package org.semanticwb.base.util.imp;


import org.semanticwb.Logger;
import org.apache.log4j.Level;
import org.semanticwb.SWBUtils;


// TODO: Auto-generated Javadoc
/* Se eliminan los comentarios de documentación de esta clase, para que
 * se hereden los de la clase padre. */
/**
 * The Class Logger4jImpl.
 * 
 * @author Jei
 */
public class Logger4jImpl implements Logger
{


    //Definir objetos para ambos Loggers
    /**
     * Instance of a Logger.
     * 

Instancia de un logger.

*/ private org.apache.log4j.Logger log = null; //Definir objetos para ambos Loggers /** * Reference to the object class from which the logger will be used. *

Referencia a la clase (tipo) del objeto desde la que se usará el * logger.

*/ private Class cls = null; /** * Identifier for the TRACE kind of message in the log. This kind of * message must provide the information needed to trace an error or exceptional condition. *

Identificador para el tipo de mensaje TRACE en la bitácora. * Este tipo de mensaje debe proveer la información necesaria para rastrear * un error o condición excepcional.

*/ private static final String TRACE = "trace"; /** * Identifier for the DEBUG kind of message in the log. This kind of * message must provide information for bug identification and resolution. *

Identificador para el tipo de mensaje DEBUG en la bitácora. * Este tipo de mensaje debe mostrar información para identificación * y resolución de bugs.

*/ private static final String DEBUG = "debug"; /** * Identifier for the INFO kind of message in the log. This kind of * message provides information in a general manner. *

Identificador para el tipo de mensaje INFO en la bitácora. * Este tipo de mensaje muestra información de manera general.

*/ private static final String INFO = "info"; /** * Identifier for the WARN kind of message in the log. This kind of * message provides a warning about a certain situation. *

Identificador para el tipo de mensaje WARN en la bitácora. * Este tipo de mensaje provee una advertencia sobre cierta situació.

*/ private static final String WARN = "warn"; /** * Identifier for the ERROR kind of message in the log. This kind of * message provides notice of an error and information related to that error. *

Identificador para el tipo de mensaje ERROR en la bitácora. * Este tipo de mensaje provee notificación sobre un error e información * relacionada a ese error.

*/ private static final String ERROR = "error"; /** * Identifier for the FATAL kind of message in the log. This kind of * message provides notice of a situation from which the application cannot recover. *

Identificador para el tipo de mensaje FATAL en la bitácora. * Este tipo de mensaje provee notificación de una situación de * la que la aplicación no se puede recuperar.

*/ private static final String FATAL = "fatal"; /** * Identifier for the EVENT kind of message in the log. This kind of * message provides notice of the happening of a specific event. *

Identificador para el tipo de mensaje EVENT en la bitácora. * Este tipo de mensaje provee notificación de la ocurrencia de un evento * específico.

*/ private static final String EVENT = "event"; /** * Creates an instance of this logger associating the class that will use it. *

Crea una instancia de este logger asociando la clase que lo usará.

* @param cls the object class from which the logger will be used */ public Logger4jImpl(Class cls) { this.log = org.apache.log4j.Logger.getLogger(cls); this.cls = cls; } /* (non-Javadoc) * @see org.semanticwb.Logger#trace(java.lang.String, java.lang.Throwable) */ public void trace(String txt, Throwable t) { log.trace(txt,t); SWBUtils.ERROR.addError(txt, t, cls, Logger4jImpl.TRACE); } /* (non-Javadoc) * @see org.semanticwb.Logger#trace(java.lang.String) */ public void trace(String txt) { log.trace(txt); } /* (non-Javadoc) * @see org.semanticwb.Logger#trace(java.lang.Throwable) */ public void trace(Throwable t) { log.trace(null,t); SWBUtils.ERROR.addError(null, t, cls, Logger4jImpl.TRACE); } /* * Usado para debugueos */ /* (non-Javadoc) * @see org.semanticwb.Logger#debug(java.lang.String, java.lang.Throwable) */ public void debug(String txt, Throwable t) { log.debug(txt,t); SWBUtils.ERROR.addError(txt, t, cls, Logger4jImpl.DEBUG); } /* (non-Javadoc) * @see org.semanticwb.Logger#debug(java.lang.String) */ public void debug(String txt) { log.debug(txt); } /* (non-Javadoc) * @see org.semanticwb.Logger#debug(java.lang.Throwable) */ public void debug(Throwable t) { log.debug(null,t); SWBUtils.ERROR.addError(null, t, cls, Logger4jImpl.DEBUG); } /* * Usado para Informacion del Sistema */ /* (non-Javadoc) * @see org.semanticwb.Logger#info(java.lang.String, java.lang.Throwable) */ public void info(String txt, Throwable t) { log.info(txt,t); SWBUtils.ERROR.addError(txt, t, cls, Logger4jImpl.INFO); } /* (non-Javadoc) * @see org.semanticwb.Logger#info(java.lang.String) */ public void info(String txt) { log.info(txt); } /* (non-Javadoc) * @see org.semanticwb.Logger#info(java.lang.Throwable) */ public void info(Throwable t) { log.info(null,t); SWBUtils.ERROR.addError(null, t, cls, Logger4jImpl.INFO); } /* (non-Javadoc) * @see org.semanticwb.Logger#warn(java.lang.String, java.lang.Throwable) */ public void warn(String txt, Throwable t) { log.warn(txt,t); SWBUtils.ERROR.addError(txt, t, cls, Logger4jImpl.WARN); } /* (non-Javadoc) * @see org.semanticwb.Logger#warn(java.lang.String) */ public void warn(String txt) { log.warn(txt); } /* (non-Javadoc) * @see org.semanticwb.Logger#warn(java.lang.Throwable) */ public void warn(Throwable t) { log.warn(null,t); SWBUtils.ERROR.addError(null, t, cls, Logger4jImpl.WARN); } /* * Usado para Errores */ /* (non-Javadoc) * @see org.semanticwb.Logger#error(java.lang.String, java.lang.Throwable) */ public void error(String txt, Throwable t) { log.error(txt,t); SWBUtils.ERROR.addError(txt, t, cls, Logger4jImpl.ERROR); } /* (non-Javadoc) * @see org.semanticwb.Logger#error(java.lang.String) */ public void error(String txt) { log.error(txt); } /* (non-Javadoc) * @see org.semanticwb.Logger#error(java.lang.Throwable) */ public void error(Throwable t) { log.error(null,t); SWBUtils.ERROR.addError(null, t, cls, Logger4jImpl.ERROR); } /* * Usado para Errores RunTime Exceptions */ /* (non-Javadoc) * @see org.semanticwb.Logger#fatal(java.lang.String, java.lang.Throwable) */ public void fatal(String txt, Throwable t) { log.fatal(txt,t); SWBUtils.ERROR.addError(txt, t, cls, Logger4jImpl.FATAL); } /* (non-Javadoc) * @see org.semanticwb.Logger#fatal(java.lang.String) */ public void fatal(String txt) { log.fatal(txt); } /* (non-Javadoc) * @see org.semanticwb.Logger#fatal(java.lang.Throwable) */ public void fatal(Throwable t) { log.fatal(null,t); SWBUtils.ERROR.addError(null, t, cls, Logger4jImpl.FATAL); } /* * Usado para notificacion de eventos */ /* (non-Javadoc) * @see org.semanticwb.Logger#event(java.lang.String, java.lang.Throwable) */ public void event(String txt, Throwable t) { log.log(Level.OFF, txt, t); SWBUtils.ERROR.addError(txt, t, cls, Logger4jImpl.EVENT); } /* (non-Javadoc) * @see org.semanticwb.Logger#event(java.lang.String) */ public void event(String txt) { log.log(Level.OFF, txt); } /* (non-Javadoc) * @see org.semanticwb.Logger#event(java.lang.Throwable) */ public void event(Throwable t) { log.log(Level.OFF, null, t); SWBUtils.ERROR.addError(null, t, cls, Logger4jImpl.EVENT); } public boolean isDebugEnabled() { return log.isDebugEnabled(); } public boolean isTraceEnabled() { return log.isTraceEnabled(); } public boolean isInfoEnabled() { return log.isInfoEnabled(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy