How to specify %m{nolookups} in log4j xml?

1,207 views
Skip to first unread message

jagannathan rajagopalan

unread,
Dec 11, 2021, 8:10:36 AM12/11/21
to Druid User
We are trying to 


"Specify "%m{nolookups}" in the PatternLayout configuration in
log4j2.xml file. Druid installations may have multiple log4j2.xml
files; be sure to update all of them."

Can you provide an example how to specify the same?

I know this is a trivial or simple ask. But please help.

Regards,
Jagan

jagannathan rajagopalan

unread,
Dec 11, 2021, 8:11:57 AM12/11/21
to Druid User
We have sample log4j.xml as follows.

<Configuration status="WARN" name="Druid" monitorInterval="30">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <JSONLayout compact="true" eventEol="true" properties="true"/>
        </Console>
    </Appenders>
    <Loggers>
        <Logger name="root" level="INFO" additivity="false">
            <appender-ref ref="Console"/>
        </Logger>
    </Loggers>
</Configuration>

Guillaume Lhermenier

unread,
Dec 11, 2021, 12:37:38 PM12/11/21
to druid...@googlegroups.com
Hi, 

Considering the last comment (from Volkan Yazici) on this issue 

I would say you have nothing to do as you are using the JsonLayout  and not the pattern layout. 

Example with %m{nolookups} is the syntax used when using PatternLayout (https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout)

However, I'm not 100% sure if the removal of the class from the jar may still be necessary.

In this case, example command provided in the issue is
zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class

Also note that Jihoon Son wrote about the JndiManager class that can be removed. 

--
You received this message because you are subscribed to the Google Groups "Druid User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to druid-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/druid-user/923fd590-8481-490a-9490-30092a2e453dn%40googlegroups.com.

Hassain K

unread,
Dec 13, 2021, 1:25:09 AM12/13/21
to Druid User
Hi ALL,

pls provide sample log4j.xml to include  "%m{nolookups}" 

my sample log4j.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!--
 ~ Licensed to the Apache Software Foundation (ASF) under one
 ~ or more contributor license agreements.  See the NOTICE file
 ~ distributed with this work for additional information
 ~ regarding copyright ownership.  The ASF licenses this file
 ~ to you under the Apache License, Version 2.0 (the
 ~ "License"); you may not use this file except in compliance
 ~ with the License.  You may obtain a copy of the License at
 ~
 ~   http://www.apache.org/licenses/LICENSE-2.0
 ~
 ~ Unless required by applicable law or agreed to in writing,
 ~ software distributed under the License is distributed on an
 ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 ~ KIND, either express or implied.  See the License for the
 ~ specific language governing permissions and limitations
 ~ under the License.
-->

<Configuration status="WARN">

  <Appenders>
    <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout pattern="%d{ISO8601} %p [%t] %c - %m%n"/>
    </Console>
  </Appenders>
  <Loggers>
    <Root level="info">
      <AppenderRef ref="Console"/>
    </Root>

    <!-- Set level="debug" to see stack traces for query errors -->
    <Logger name="org.apache.druid.server.QueryResource" level="info" additivity="false">
      <Appender-ref ref="Console"/>
    </Logger>
    <Logger name="org.apache.druid.server.QueryLifecycle" level="info" additivity="false">
      <Appender-ref ref="Console"/>
    </Logger>

    <!-- Set level="debug" or "trace" to see more Coordinator details (segment balancing, load/drop rules, etc) -->
    <Logger name="org.apache.druid.server.coordinator" level="info" additivity="false">
      <Appender-ref ref="Console"/>
    </Logger>

    <!-- Set level="debug" to see low-level details about segments and ingestion -->
    <Logger name="org.apache.druid.segment" level="info" additivity="false">
      <Appender-ref ref="Console"/>
    </Logger>

    <!-- Set level="debug" to see more information about extension initialization -->
    <Logger name="org.apache.druid.initialization" level="info" additivity="false">
      <Appender-ref ref="Console"/>
    </Logger>

    <!-- Quieter logging at startup -->
    <Logger name="org.skife.config" level="warn" additivity="false">
      <Appender-ref ref="Console"/>
    </Logger>
    <Logger name="com.sun.jersey.guice" level="warn" additivity="false">
      <Appender-ref ref="Console"/>
    </Logger>
  </Loggers>
</Configuration>

Guillaume Lhermenier

unread,
Dec 13, 2021, 1:30:35 AM12/13/21
to druid...@googlegroups.com
Hi, 

In the PatternLayout line, replace %m with %m{nolookups}



Reply all
Reply to author
Forward
0 new messages