Log4j 2
  1. Log4j 2
  2. LOG4J2-442

Log4j2 Database insert problem in Websphere

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta8
    • Fix Version/s: 2.0-rc1
    • Component/s: Appenders, Configurators
    • Labels:
      None
    • Environment:

      Java Web Service in Websphere server

      Description

      In my local,

      I created an log4j2.xml to config like that :

      log4j2.xml
      
          <?xml version="1.0" encoding="UTF-8"?>
      
          <configuration status="OFF">
            <appenders>
              <!-- Async Loggers will auto-flush in batches, so switch off immediateFlush. -->
      
              <FastFile name="AsyncFastFile" fileName="${sys:logFilename}" 
                        immediateFlush="false" append="true">
                <PatternLayout>
                  <pattern>test %m %m %ex%n</pattern>
                </PatternLayout>
              </FastFile>
      
          <JDBC name="databaseAppender" tableName="mytablename">
                <DriverManager url="jdbc:oracle:thin:ORCL_USERNAME/PASS@//MYSERVERNAME:PORTNO/DBNAME" />
                <Column name="KEY1" pattern="%X{sayi1}" />
                <Column name="KEY2" pattern="%X{sayi2}" />
                </JDBC>
      
              <JDBC name="databaseAppenderJNDI" tableName="mytablename">
            <DataSource jndiName="java:/comp/env/jdbc/logWS" />
            <Column name="KEY1" pattern="%X{sayi1}" />
            <Column name="KEY2" pattern="%X{sayi2}" />
           </JDBC>  
      
      
            </appenders>
      
            <loggers>
      
      
              <!-- pattern layout actually uses location, so we need to include it -->
              <asyncLogger name="ASYNC" level="TRACE" additivity="false">
                <appender-ref ref="databaseAppender"/>
              </asyncLogger>
      
       <!-- pattern layout actually uses location, so we need to include it -->
              <asyncLogger name="ASYNCwithJNDI" level="TRACE" additivity="false">
                <appender-ref ref="databaseAppenderJNDI"/>
              </asyncLogger>
      
      
              <root level="info" includeLocation="true">
                <appender-ref ref="databaseAppender"/>
              </root>
      
            </loggers>
          </configuration>
      

      I can insert logs to text file and DB by switching loggername in my java class which I call log function. There no problem in my local.

      In Webshere server,

      I call a web service for logging. I am using same config file and same java codes which calls log function. I can insert logs to a file but I can't insert logs to database. I tried both driverManager url and JNDI. But nothing changed. In two ways, I can't insert log to DB and program doesn't throw any error in try-catch. So I can't find problem where is.

      Note : There is no problem at JNDI url and drivermanager url. Because I can perfectly use these urls in different webservice in webshere. Also I can insert log to Database in my local with same codes.

      Note : There is no problem to insert logs to txt file. only DB insertion is problem in Websphere server. So there isn't problem at config file classpath.

      For your info, I am using oracle DB but the problem isn't about DB.
      I trace network packages in server and I realize that web service don't send any package to DB. Packages don't reach to DB.

      How can I solve this problem?

      THX.

        Issue Links

          Activity

          Barış Taşkend created issue -
          Barış Taşkend made changes -
          Field Original Value New Value
          Environment Java Web Servise in Websphere server Java Web Service in Websphere server
          Barış Taşkend made changes -
          Priority Critical [ 2 ] Blocker [ 1 ]
          Barış Taşkend made changes -
          Description In my local,

          I created an log4j2.xml to config like that :

          {code:title=log4j2.xml|borderStyle=solid}

              <?xml version="1.0" encoding="UTF-8"?>

              <configuration status="OFF">
                <appenders>
                  <!-- Async Loggers will auto-flush in batches, so switch off immediateFlush. -->

                  <FastFile name="AsyncFastFile" fileName="${sys:logFilename}"
                            immediateFlush="false" append="true">
                    <PatternLayout>
                      <pattern>test %m %m %ex%n</pattern>
                    </PatternLayout>
                  </FastFile>

              <JDBC name="databaseAppender" tableName="mytablename">
                    <DriverManager url="jdbc:oracle:thin:ORCL_USERNAME/PASS@//MYSERVERNAME:PORTNO/DBNAME" />
                    <Column name="KEY1" pattern="%X{sayi1}" />
                    <Column name="KEY2" pattern="%X{sayi2}" />
                    </JDBC>

                  <JDBC name="databaseAppenderJNDI" tableName="mytablename">
                <DataSource jndiName="java:/comp/env/jdbc/logWS" />
                <Column name="KEY1" pattern="%X{sayi1}" />
                <Column name="KEY2" pattern="%X{sayi2}" />
               </JDBC>


                </appenders>

                <loggers>


                  <!-- pattern layout actually uses location, so we need to include it -->
                  <asyncLogger name="ASYNC" level="TRACE" additivity="false">
                    <appender-ref ref="databaseAppender"/>
                  </asyncLogger>

           <!-- pattern layout actually uses location, so we need to include it -->
                  <asyncLogger name="ASYNCwithJNDI" level="TRACE" additivity="false">
                    <appender-ref ref="databaseAppenderJNDI"/>
                  </asyncLogger>


                  <root level="info" includeLocation="true">
                    <appender-ref ref="databaseAppender"/>
                  </root>

                </loggers>
              </configuration>
          {code}

          I can insert logs to text file and DB by switching loggername in my java class which I call log function. There no problem in my local.

          In Wepshere server,

          I call a web service for logging. I am using same config file and same java codes which calls log function. I can insert logs to a file but I can't insert logs to database. I tried both driverManager url and JNDI. But nothing changed. In two ways, I can't insert log to DB and program doesn't throw any error in try-catch. So I can't find problem where is.

          Note : There is no problem at JNDI url and drivermanager url. Because I can perfectly use these urls in different webservice in wepshere. Also I can insert log to Database in my local with same codes.

          Note : There is no problem to insert logs to txt file. only DB insertion is problem in Websphere server. So there isn't problem at config file classpath.

          How I can solve this problem?

          THX.
          In my local,

          I created an log4j2.xml to config like that :

          {code:title=log4j2.xml|borderStyle=solid}

              <?xml version="1.0" encoding="UTF-8"?>

              <configuration status="OFF">
                <appenders>
                  <!-- Async Loggers will auto-flush in batches, so switch off immediateFlush. -->

                  <FastFile name="AsyncFastFile" fileName="${sys:logFilename}"
                            immediateFlush="false" append="true">
                    <PatternLayout>
                      <pattern>test %m %m %ex%n</pattern>
                    </PatternLayout>
                  </FastFile>

              <JDBC name="databaseAppender" tableName="mytablename">
                    <DriverManager url="jdbc:oracle:thin:ORCL_USERNAME/PASS@//MYSERVERNAME:PORTNO/DBNAME" />
                    <Column name="KEY1" pattern="%X{sayi1}" />
                    <Column name="KEY2" pattern="%X{sayi2}" />
                    </JDBC>

                  <JDBC name="databaseAppenderJNDI" tableName="mytablename">
                <DataSource jndiName="java:/comp/env/jdbc/logWS" />
                <Column name="KEY1" pattern="%X{sayi1}" />
                <Column name="KEY2" pattern="%X{sayi2}" />
               </JDBC>


                </appenders>

                <loggers>


                  <!-- pattern layout actually uses location, so we need to include it -->
                  <asyncLogger name="ASYNC" level="TRACE" additivity="false">
                    <appender-ref ref="databaseAppender"/>
                  </asyncLogger>

           <!-- pattern layout actually uses location, so we need to include it -->
                  <asyncLogger name="ASYNCwithJNDI" level="TRACE" additivity="false">
                    <appender-ref ref="databaseAppenderJNDI"/>
                  </asyncLogger>


                  <root level="info" includeLocation="true">
                    <appender-ref ref="databaseAppender"/>
                  </root>

                </loggers>
              </configuration>
          {code}

          I can insert logs to text file and DB by switching loggername in my java class which I call log function. There no problem in my local.

          In Wepshere server,

          I call a web service for logging. I am using same config file and same java codes which calls log function. I can insert logs to a file but I can't insert logs to database. I tried both driverManager url and JNDI. But nothing changed. In two ways, I can't insert log to DB and program doesn't throw any error in try-catch. So I can't find problem where is.

          Note : There is no problem at JNDI url and drivermanager url. Because I can perfectly use these urls in different webservice in wepshere. Also I can insert log to Database in my local with same codes.

          Note : There is no problem to insert logs to txt file. only DB insertion is problem in Websphere server. So there isn't problem at config file classpath.

          For your info, I am using oracle DB but the problem isn't about DB.
          I trace network packages in server and I realize that web service don't send any package to DB. Packages don't reach to DB.

          How I can solve this problem?

          THX.
          Barış Taşkend made changes -
          Description In my local,

          I created an log4j2.xml to config like that :

          {code:title=log4j2.xml|borderStyle=solid}

              <?xml version="1.0" encoding="UTF-8"?>

              <configuration status="OFF">
                <appenders>
                  <!-- Async Loggers will auto-flush in batches, so switch off immediateFlush. -->

                  <FastFile name="AsyncFastFile" fileName="${sys:logFilename}"
                            immediateFlush="false" append="true">
                    <PatternLayout>
                      <pattern>test %m %m %ex%n</pattern>
                    </PatternLayout>
                  </FastFile>

              <JDBC name="databaseAppender" tableName="mytablename">
                    <DriverManager url="jdbc:oracle:thin:ORCL_USERNAME/PASS@//MYSERVERNAME:PORTNO/DBNAME" />
                    <Column name="KEY1" pattern="%X{sayi1}" />
                    <Column name="KEY2" pattern="%X{sayi2}" />
                    </JDBC>

                  <JDBC name="databaseAppenderJNDI" tableName="mytablename">
                <DataSource jndiName="java:/comp/env/jdbc/logWS" />
                <Column name="KEY1" pattern="%X{sayi1}" />
                <Column name="KEY2" pattern="%X{sayi2}" />
               </JDBC>


                </appenders>

                <loggers>


                  <!-- pattern layout actually uses location, so we need to include it -->
                  <asyncLogger name="ASYNC" level="TRACE" additivity="false">
                    <appender-ref ref="databaseAppender"/>
                  </asyncLogger>

           <!-- pattern layout actually uses location, so we need to include it -->
                  <asyncLogger name="ASYNCwithJNDI" level="TRACE" additivity="false">
                    <appender-ref ref="databaseAppenderJNDI"/>
                  </asyncLogger>


                  <root level="info" includeLocation="true">
                    <appender-ref ref="databaseAppender"/>
                  </root>

                </loggers>
              </configuration>
          {code}

          I can insert logs to text file and DB by switching loggername in my java class which I call log function. There no problem in my local.

          In Wepshere server,

          I call a web service for logging. I am using same config file and same java codes which calls log function. I can insert logs to a file but I can't insert logs to database. I tried both driverManager url and JNDI. But nothing changed. In two ways, I can't insert log to DB and program doesn't throw any error in try-catch. So I can't find problem where is.

          Note : There is no problem at JNDI url and drivermanager url. Because I can perfectly use these urls in different webservice in wepshere. Also I can insert log to Database in my local with same codes.

          Note : There is no problem to insert logs to txt file. only DB insertion is problem in Websphere server. So there isn't problem at config file classpath.

          For your info, I am using oracle DB but the problem isn't about DB.
          I trace network packages in server and I realize that web service don't send any package to DB. Packages don't reach to DB.

          How I can solve this problem?

          THX.
          In my local,

          I created an log4j2.xml to config like that :

          {code:title=log4j2.xml|borderStyle=solid}

              <?xml version="1.0" encoding="UTF-8"?>

              <configuration status="OFF">
                <appenders>
                  <!-- Async Loggers will auto-flush in batches, so switch off immediateFlush. -->

                  <FastFile name="AsyncFastFile" fileName="${sys:logFilename}"
                            immediateFlush="false" append="true">
                    <PatternLayout>
                      <pattern>test %m %m %ex%n</pattern>
                    </PatternLayout>
                  </FastFile>

              <JDBC name="databaseAppender" tableName="mytablename">
                    <DriverManager url="jdbc:oracle:thin:ORCL_USERNAME/PASS@//MYSERVERNAME:PORTNO/DBNAME" />
                    <Column name="KEY1" pattern="%X{sayi1}" />
                    <Column name="KEY2" pattern="%X{sayi2}" />
                    </JDBC>

                  <JDBC name="databaseAppenderJNDI" tableName="mytablename">
                <DataSource jndiName="java:/comp/env/jdbc/logWS" />
                <Column name="KEY1" pattern="%X{sayi1}" />
                <Column name="KEY2" pattern="%X{sayi2}" />
               </JDBC>


                </appenders>

                <loggers>


                  <!-- pattern layout actually uses location, so we need to include it -->
                  <asyncLogger name="ASYNC" level="TRACE" additivity="false">
                    <appender-ref ref="databaseAppender"/>
                  </asyncLogger>

           <!-- pattern layout actually uses location, so we need to include it -->
                  <asyncLogger name="ASYNCwithJNDI" level="TRACE" additivity="false">
                    <appender-ref ref="databaseAppenderJNDI"/>
                  </asyncLogger>


                  <root level="info" includeLocation="true">
                    <appender-ref ref="databaseAppender"/>
                  </root>

                </loggers>
              </configuration>
          {code}

          I can insert logs to text file and DB by switching loggername in my java class which I call log function. There no problem in my local.

          In Webshere server,

          I call a web service for logging. I am using same config file and same java codes which calls log function. I can insert logs to a file but I can't insert logs to database. I tried both driverManager url and JNDI. But nothing changed. In two ways, I can't insert log to DB and program doesn't throw any error in try-catch. So I can't find problem where is.

          Note : There is no problem at JNDI url and drivermanager url. Because I can perfectly use these urls in different webservice in webshere. Also I can insert log to Database in my local with same codes.

          Note : There is no problem to insert logs to txt file. only DB insertion is problem in Websphere server. So there isn't problem at config file classpath.

          For your info, I am using oracle DB but the problem isn't about DB.
          I trace network packages in server and I realize that web service don't send any package to DB. Packages don't reach to DB.

          How I can solve this problem?

          THX.
          Barış Taşkend made changes -
          Description In my local,

          I created an log4j2.xml to config like that :

          {code:title=log4j2.xml|borderStyle=solid}

              <?xml version="1.0" encoding="UTF-8"?>

              <configuration status="OFF">
                <appenders>
                  <!-- Async Loggers will auto-flush in batches, so switch off immediateFlush. -->

                  <FastFile name="AsyncFastFile" fileName="${sys:logFilename}"
                            immediateFlush="false" append="true">
                    <PatternLayout>
                      <pattern>test %m %m %ex%n</pattern>
                    </PatternLayout>
                  </FastFile>

              <JDBC name="databaseAppender" tableName="mytablename">
                    <DriverManager url="jdbc:oracle:thin:ORCL_USERNAME/PASS@//MYSERVERNAME:PORTNO/DBNAME" />
                    <Column name="KEY1" pattern="%X{sayi1}" />
                    <Column name="KEY2" pattern="%X{sayi2}" />
                    </JDBC>

                  <JDBC name="databaseAppenderJNDI" tableName="mytablename">
                <DataSource jndiName="java:/comp/env/jdbc/logWS" />
                <Column name="KEY1" pattern="%X{sayi1}" />
                <Column name="KEY2" pattern="%X{sayi2}" />
               </JDBC>


                </appenders>

                <loggers>


                  <!-- pattern layout actually uses location, so we need to include it -->
                  <asyncLogger name="ASYNC" level="TRACE" additivity="false">
                    <appender-ref ref="databaseAppender"/>
                  </asyncLogger>

           <!-- pattern layout actually uses location, so we need to include it -->
                  <asyncLogger name="ASYNCwithJNDI" level="TRACE" additivity="false">
                    <appender-ref ref="databaseAppenderJNDI"/>
                  </asyncLogger>


                  <root level="info" includeLocation="true">
                    <appender-ref ref="databaseAppender"/>
                  </root>

                </loggers>
              </configuration>
          {code}

          I can insert logs to text file and DB by switching loggername in my java class which I call log function. There no problem in my local.

          In Webshere server,

          I call a web service for logging. I am using same config file and same java codes which calls log function. I can insert logs to a file but I can't insert logs to database. I tried both driverManager url and JNDI. But nothing changed. In two ways, I can't insert log to DB and program doesn't throw any error in try-catch. So I can't find problem where is.

          Note : There is no problem at JNDI url and drivermanager url. Because I can perfectly use these urls in different webservice in webshere. Also I can insert log to Database in my local with same codes.

          Note : There is no problem to insert logs to txt file. only DB insertion is problem in Websphere server. So there isn't problem at config file classpath.

          For your info, I am using oracle DB but the problem isn't about DB.
          I trace network packages in server and I realize that web service don't send any package to DB. Packages don't reach to DB.

          How I can solve this problem?

          THX.
          In my local,

          I created an log4j2.xml to config like that :

          {code:title=log4j2.xml|borderStyle=solid}

              <?xml version="1.0" encoding="UTF-8"?>

              <configuration status="OFF">
                <appenders>
                  <!-- Async Loggers will auto-flush in batches, so switch off immediateFlush. -->

                  <FastFile name="AsyncFastFile" fileName="${sys:logFilename}"
                            immediateFlush="false" append="true">
                    <PatternLayout>
                      <pattern>test %m %m %ex%n</pattern>
                    </PatternLayout>
                  </FastFile>

              <JDBC name="databaseAppender" tableName="mytablename">
                    <DriverManager url="jdbc:oracle:thin:ORCL_USERNAME/PASS@//MYSERVERNAME:PORTNO/DBNAME" />
                    <Column name="KEY1" pattern="%X{sayi1}" />
                    <Column name="KEY2" pattern="%X{sayi2}" />
                    </JDBC>

                  <JDBC name="databaseAppenderJNDI" tableName="mytablename">
                <DataSource jndiName="java:/comp/env/jdbc/logWS" />
                <Column name="KEY1" pattern="%X{sayi1}" />
                <Column name="KEY2" pattern="%X{sayi2}" />
               </JDBC>


                </appenders>

                <loggers>


                  <!-- pattern layout actually uses location, so we need to include it -->
                  <asyncLogger name="ASYNC" level="TRACE" additivity="false">
                    <appender-ref ref="databaseAppender"/>
                  </asyncLogger>

           <!-- pattern layout actually uses location, so we need to include it -->
                  <asyncLogger name="ASYNCwithJNDI" level="TRACE" additivity="false">
                    <appender-ref ref="databaseAppenderJNDI"/>
                  </asyncLogger>


                  <root level="info" includeLocation="true">
                    <appender-ref ref="databaseAppender"/>
                  </root>

                </loggers>
              </configuration>
          {code}

          I can insert logs to text file and DB by switching loggername in my java class which I call log function. There no problem in my local.

          In Webshere server,

          I call a web service for logging. I am using same config file and same java codes which calls log function. I can insert logs to a file but I can't insert logs to database. I tried both driverManager url and JNDI. But nothing changed. In two ways, I can't insert log to DB and program doesn't throw any error in try-catch. So I can't find problem where is.

          Note : There is no problem at JNDI url and drivermanager url. Because I can perfectly use these urls in different webservice in webshere. Also I can insert log to Database in my local with same codes.

          Note : There is no problem to insert logs to txt file. only DB insertion is problem in Websphere server. So there isn't problem at config file classpath.

          For your info, I am using oracle DB but the problem isn't about DB.
          I trace network packages in server and I realize that web service don't send any package to DB. Packages don't reach to DB.

          How can I solve this problem?

          THX.
          Nick Williams made changes -
          Assignee Nick Williams [ beamerblvd ]
          Nick Williams made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Nick Williams made changes -
          Link This issue relates to LOG4J2-407 [ LOG4J2-407 ]
          Nick Williams made changes -
          Link This issue relates to LOG4J2-438 [ LOG4J2-438 ]
          Nick Williams made changes -
          Link This issue is related to LOG4J2-457 [ LOG4J2-457 ]
          Nick Williams made changes -
          Link This issue is related to LOG4J2-489 [ LOG4J2-489 ]
          Nick Williams made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Fix Version/s 2.0-rc1 [ 12325011 ]
          Resolution Fixed [ 1 ]
          Nick Williams made changes -
          Link This issue relates to LOG4J2-489 [ LOG4J2-489 ]
          Nick Williams made changes -
          Link This issue relates to LOG4J2-457 [ LOG4J2-457 ]
          Nick Williams made changes -
          Link This issue is related to LOG4J2-438 [ LOG4J2-438 ]
          Nick Williams made changes -
          Link This issue is related to LOG4J2-407 [ LOG4J2-407 ]

            People

            • Assignee:
              Nick Williams
              Reporter:
              Barış Taşkend
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development