public JmsAppender build()

in log4j-jakarta-jms/src/main/java/org/apache/logging/log4j/jms/appender/JmsAppender.java [95:141]


        public JmsAppender build() {
            final boolean jndiJmsEnabled = getConfiguration()
                    .getEnvironment()
                    .getProperty(JndiProperties.class)
                    .enableJms();
            if (!jndiJmsEnabled) {
                LOGGER.error("JNDI has not been enabled. The `log4j.jndi.enableJms` property must be set to `true`");
                return null;
            }
            JmsManager actualJmsManager = jmsManager;
            JmsManagerConfiguration configuration = null;
            if (actualJmsManager == null) {
                final Properties additionalProperties = null;
                final Properties jndiProperties = JmsManager.createJndiProperties(
                        factoryName,
                        providerUrl,
                        urlPkgPrefixes,
                        securityPrincipalName,
                        securityCredentials,
                        additionalProperties);
                configuration = new JmsManagerConfiguration(
                        jndiProperties,
                        factoryBindingName,
                        destinationBindingName,
                        userName,
                        password,
                        false,
                        reconnectIntervalMillis);
                actualJmsManager = AbstractManager.getManager(getName(), JmsManager.FACTORY, configuration);
            }
            if (actualJmsManager == null) {
                // JmsManagerFactory has already logged an ERROR.
                return null;
            }
            try {
                return new JmsAppender(
                        getName(),
                        getFilter(),
                        getLayout(),
                        isIgnoreExceptions(),
                        getPropertyArray(),
                        actualJmsManager);
            } catch (final JMSException e) {
                //  Never happens since the ctor no longer actually throws a JMSException.
                throw new IllegalStateException(e);
            }
        }