Search code examples
jbossjboss7.xlogbackjndislf4j

Where to put Logback JNDI for Jboss webapp?


For a jboss .war application I received instructions to configure its SLF4j/Logback, setting a folder path string with java:/comp/env/xyz JNDI variable. I'm using Jboss EAP 7, do I need to set it somewhere in the standalone.xml file? What syntax should be used? The official Logback docs don't help me with Jboss.

EDIT: More info, the actual code looks for the resource in this way:

basepath = (String) initialContext.lookup("java:/comp/env/" + MyBasePath);

Solution

  • I answer myself, the variable can be set in standalone.xml here:

    <subsystem xmlns="urn:jboss:domain:naming:2.0">
                <bindings>
                    <simple name="java:/comp/env/xyz" value="<PATH>" type="java.lang.String"/>
                </bindings>
                <remote-naming/>
    </subsystem>