[jboss-jira] [JBoss JIRA] (AS7-4908) Error
David Lloyd (JIRA)
jira-events at lists.jboss.org
Tue May 29 12:36:17 EDT 2012
[ https://issues.jboss.org/browse/AS7-4908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12696901#comment-12696901 ]
David Lloyd commented on AS7-4908:
----------------------------------
There are two different ways you can solve this problem.
# Bundle your own log4j.jar, and add a {{jboss-deployment-structure.xml}} descriptor which excludes {{org.apache.log4j}} from your deployment. This will give your deployment complete control over its log4j usage. See https://docs.jboss.org/author/display/AS71/How+To for more information on that.
# Switch to using our standard per-deployment log configuration mechanism instead of using your custom selector (will require 7.1.2 or 7.2 to work). If you have a log4j.xml (or similar) in your deployment, it will automatically be detected and utilized and you won't need a custom selector.
> Error
> -----
>
> Key: AS7-4908
> URL: https://issues.jboss.org/browse/AS7-4908
> Project: Application Server 7
> Issue Type: Feature Request
> Components: Class Loading
> Affects Versions: 7.1.1.Final
> Reporter: Pablo Ochoa
> Assignee: David Lloyd
> Fix For: 7.1.1.Final
>
>
> Buenos Días,
> Tengo problema con la version 7.1.1 de Jboss por defecto viene creado un Selector y yo intento crea uno nuevo para el manejo de mi classes me arroja el siguiente error
> Preferred repository selector not installed because one has already exists. No problem, using existing selector...
> Estado investigando de verdad no conseguido algo para poder solventar este problema el la ultima version de Jboss 6 no ocurre este mismo problema agradezco toda la colaboración que me puedan brindar
> Te anexo el codigo que utilizo
> import java.util.*;
> import javax.naming.*;
> import org.apache.log4j.Hierarchy;
> import org.apache.log4j.Level;
> import org.apache.log4j.spi.*;
> public class Log4jContextJNDISelector
> implements RepositorySelector
> {
> public Log4jContextJNDISelector(){
> defaultHierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
> }
> public LoggerRepository getLoggerRepository()
> {
> String loggingContextName = null;
> try
> {
> Context ctx = new InitialContext();
> loggingContextName = (String)ctx.lookup("java:comp/env/log4j/logging-context");
> }
> catch(NamingException ne) { }
> if(loggingContextName == null)
> return defaultHierarchy;
> Hierarchy hierarchy = (Hierarchy)hierMap.get(loggingContextName);
> if(hierarchy == null)
> {
> hierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
> hierMap.put(loggingContextName, hierarchy);
> }
> return hierarchy;
> }
> Archivo web.xml esta configuración
> <context-param>
> <param-name>log4j-selector</param-name>
> <param-value>ve.com.prueba.gdis.cia.config.logging.Log4jContextJNDISelector</param-value>
> <description> Selector de repositorios basado en JNDI desde donde se
> configurar el repositorio de logs para esta aplicación
> </description>
> </context-param>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list