Solved

log4j:WARN No appenders could be found for logger

Posted on 2004-08-03
28
107,262 Views
Last Modified: 2011-08-18
Hi there....
I got above error and below are my java files....Pls help me to see what is wrong with my script?

I know that my points currently not enough, but i do hope someone will entertain me in this problem........

thanks very much

-----------------------------------------------
DataMirror.java(1st file)
------------------------------------------------
package com.db.util;


import java.sql.*;
import java.io.*;
import java.util.Calendar;

import org.apache.log4j.PropertyConfigurator;                                                                
import org.apache.log4j.Logger;

import com.db.util.ConfigProperties;

public class DataMirrorAgentWap {
      static Logger logger = Logger.getLogger( DataMirror.class.getName() );
      
      protected final static String CONFIG_FILE       = "wdb_mir.properties";
      private static String log_config      = "2w_por_log4j.properties";
      
      private final static String db_source_driver      = "org.gjt.mm.mysql.Driver";
      private final static String db_source_url            = "jdbc:mysql://localhost/content";
      private final static String db_source_username      = "content";
      private final static String db_source_password      = "content";
      
      // Target DB
      private final static String db_target_driver      = "org.gjt.mm.mysql.Driver";
      private final static String db_target_url            = "jdbc:mysql://localhost/content_w";
      private final static String db_target_username      = "content";
      private final static String db_target_password      = "content";
      
      private String sDB_Source_Driver      = null;
      private String sDB_Source_Url            = null;
      private String sDB_Source_Username      = null;
      private String sDB_Source_Password      = null;
      private String sDB_Target_Driver      = null;
      private String sDB_Target_Url            = null;
      private String sDB_Target_Username      = null;
      private String sDB_Target_Password      = null;

      private Connection dbSourceConnection      = null;
      private Connection dbTargetConnection      = null;
      

      private String chargeid;
    private String contentid;
    private String providerid;
    private String thumbnail;
    private int contenttype;
    private int contenttype_;
    private String timestamp_;    
    private String timestamp_2;
    private int artistid_;
    private String artist_desc;
      
      public DataMirror() {
            init();
      }
      
      private void init() {
            sDB_Source_Driver      = ConfigProperties.getProperty( db_source_driver );
            sDB_Source_Url            = ConfigProperties.getProperty( db_source_url );
            sDB_Source_Username      = ConfigProperties.getProperty( db_source_username );
            sDB_Source_Password      = ConfigProperties.getProperty( db_source_password );

            sDB_Target_Driver      = ConfigProperties.getProperty( db_target_driver );
            sDB_Target_Url            = ConfigProperties.getProperty( db_target_url );
            sDB_Target_Username      = ConfigProperties.getProperty( db_target_username );
            sDB_Target_Password      = ConfigProperties.getProperty( db_target_password );
            
      }
      
      public void connectDBSource() {
            logger.info( "Connecting Database Source..." );
            try {
                  Class.forName(sDB_Source_Driver);
                  dbSourceConnection      = DriverManager.getConnection( sDB_Source_Url,
                        sDB_Source_Username, sDB_Source_Password );
                  logger.info( "Connecting Database Source...done" );
            }
            catch(SQLException sqle) {
                  logger.error( "SQLException in connectDBSource(): " + sqle );
            }
            catch(Exception e) {
                  logger.error( "Exception in connectDBSource(): " + e );
            }
      }

      public void connectDBTarget() {
            logger.info( "Connecting Database Target..." );
            try {
                  Class.forName(sDB_Target_Driver);
                  dbTargetConnection      = DriverManager.getConnection( sDB_Target_Url,
                        sDB_Target_Username, sDB_Target_Password );
                  logger.info( "Connecting Database Target...done" );
            }
            catch(SQLException sqle) {
                  logger.error( "SQLException in connectDBTarget(): " + sqle );
            }
            catch(Exception e) {
                  logger.error( "Exception in connectDBTarget(): " + e );
            }
      }

      public void disconnectDBSource() {
            logger.info( "Disconnecting Database Source..." );

            if( dbSourceConnection != null ) {
                  try {      
                        dbSourceConnection.close();
                        logger.info( "Disconnecting Database Source...done" );
                  }
                  catch(SQLException sqle) {
                        logger.error( "SQLException in disconnectDBSource(): " + sqle );
                  }
            }
      }

      public void disconnectDBTarget() {
            logger.info( "Disconnecting Database Target..." );

            if( dbTargetConnection != null ) {
                  try {      
                        dbTargetConnection.close();
                        logger.info( "Disconnecting Database Target...done" );
                  }
                  catch(SQLException sqle) {
                        logger.error( "SQLException in disconnectDBTarget(): " + sqle );
                  }
            }
      }
      
      public boolean updateContent( ResultSet rs ) {
            boolean bUpdateResult      = false;

            if( rs == null ) {
                  return bUpdateResult;
            }

            String sUpdateSQL      = "INSERT INTO content_2 "
                  + " (CONTENT_ID, TITLE, CONTENT_DESC, ARTIST, CHARGE_ID, CONTENT_TYPE, CATEGORY_ID, PROVIDER_ID,"
                  + " FILE_REF, THUMBNAIL, OTHER_ID, OTHER_OWNER, UPD_TIMESTAMP)"
                  + " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";

            PreparedStatement stmt      = null;
            
            int iResult      = 0;

            try {
                  if( dbTargetConnection == null ) {
                        connectDBTarget();
                  }

            //Get Artist Description
            contenttype = Integer.parseInt(rs.getString(6));
            timestamp_ = rs.getString(9);
            artistid_ = rs.getInt(10);  
            providerid = "CP0001";
           
            convert_Content_Type();
            determine_Charge_ID();
            determine_Thumbnail();
            trim_Timestamp();
            search_Artist_Desc();


                  stmt      = dbTargetConnection.prepareStatement( sUpdateSQL );
                  stmt.setString( 1, rs.getString(1) );
                  stmt.setString( 2, rs.getString(2) );
                  stmt.setString( 3, rs.getString(3) );
                  stmt.setString( 4, artist_desc );
                  stmt.setString( 5, chargeid );
                  stmt.setInt( 6, contenttype_ );
                  stmt.setInt( 7, rs.getInt(7) );
                  stmt.setString( 8, providerid );
                  stmt.setString( 9, rs.getString(9) );
                  stmt.setString( 10, thumbnail );
                  stmt.setString( 11, rs.getString(11) );
                  stmt.setString( 12, rs.getString(12) );
                  stmt.setString( 13, timestamp_2 );
                  

                  iResult        = stmt.executeUpdate();

                  if( iResult > 0 ) {
                        bUpdateResult      = true;
                  }
            }
            catch( SQLException sqle ) {
                  logger.error( "SQLException in updateContent: " + sqle );
            }
            catch( Exception e ) {
                  logger.error( "Exception in updateContent: " + e );
            }

            return bUpdateResult;
      }
      
      //populate the database based on the timeframe
      public int populateContent2( java.util.Date date, int Index, int Limit ) {
            logger.info( "Populating Data Incoming..." );


            long lStartTime      = System.currentTimeMillis();

            int iTotalRead            = 0;
            int iTotalUpdate      = 0;
            

            if( date == null ) {
                  date      = new java.util.Date();
            }

            java.sql.Date sqlDate      = new java.sql.Date( date.getTime() );

            String sSQL      = "SELECT CONTENT_REF,TITLE,CONTENT_DESC,CATEGORY_ID,FILE_REF,content_type,"
                          +"OTHER_ID,OTHER_OWNER,UPDATE_TIME,ARTIST_ID"
                          +"FROM content WHERE UPDATE_TIME>= ? LIMIT ?,?";

            ResultSet rs                  = null;
            PreparedStatement stmt      = null;

            try {
                  if( dbSourceConnection == null ) {
                        connectDBSource();
                  }

                  stmt      = dbSourceConnection.prepareStatement( sSQL );
                  stmt.setDate( 1, sqlDate );
                  stmt.setInt( 2, Index );
                  stmt.setInt( 3, Limit );
                  rs        = stmt.executeQuery();

                  boolean bUpdateResult      = false;
                  while( rs.next() ) {
                        iTotalRead++;
                        bUpdateResult      = updateContent(rs);

                        if( bUpdateResult ) {
                              iTotalUpdate++;      
                        }
                  }
            }
            catch( SQLException sqle ) {
                  logger.error( "SQLException in populateContent: " + sqle );
            }
            catch( Exception e ) {
                  logger.error( "Exception in populateContent: " + e );
            }

            long lElapsedTime      = (System.currentTimeMillis() - lStartTime) / 1000;

            logger.info( "Transaction Date: " + date );
            logger.info( "Total Read: " + iTotalRead + " record(s)" );
            logger.info( "Total Update: " + iTotalUpdate + " record(s)" );
            logger.info( "Process time: " + lElapsedTime + " sec(s)" );

            logger.info( "Populating content_2...done" );

            return iTotalRead;
      }
      
      /*Determine static Data for content_2*/
      private void convert_Content_Type(){
            
      if(contenttype == 11)
      
         contenttype_ = 1;
             
         else if(contenttype == 12)
        
             contenttype_ = 6;
             
               else if(contenttype == 15)
               
                    contenttype_ = 4;
                    
                         else if(contenttype == 18)
                         
                              contenttype_ = 5;      
      }      

      private void determine_Charge_ID(){
            
      if(contenttype == 11)
      
         chargeid = "MONOCHG1";
        
         else if(contenttype == 12)
        
             chargeid = "POLYCHG1";
             
               else if(contenttype == 15)
               
                    chargeid = "MMSCHG1";
                    
                         else if(contenttype == 18)
                         
                              chargeid = "JAVACHG1";
      }                

      private void determine_Thumbnail() {            
      //content type: mono/poly ringtones
      if(contenttype == 11 || contenttype == 12)
      
         thumbnail = "NULL";
        
              //content type: wallpapers
              else if(contenttype == 15)
               
                  thumbnail = "NULL";
                    
                         //content type: JAVA games            
                         else if(contenttype == 18)
                         
                              thumbnail = "NULL";      
      }


      private void trim_Timestamp(){            
        timestamp_2 = timestamp_.substring(1,14);
      }
      
      
      private void search_Artist_Desc(){            
            ResultSet rs                  = null;
            Statement statement          = null;
      
            try {
                        if( dbSourceConnection == null ) {
                              connectDBSource();
                        }
             
             statement      = dbSourceConnection.createStatement();
      
             String query = "SELECT artist_name FROM artist "
                                    +"WHERE ARTIST_ID = '"
                                    +artistid_+ "'";
             rs = statement.executeQuery( query );
             getArtist( rs );
             statement.close();
             }
             catch( SQLException sqle ) {
                        logger.error( "SQLException in search_Artist_Desc: " + sqle );
             }
             catch( Exception e ) {
                        logger.error( "Exception in search_Artist_Desc: " + e );
             }
      }

       public void getArtist( ResultSet rs )
         {
             try {        
                  
               rs.next();
            
               artist_desc = rs.getString(1);
              }
               catch( SQLException sqle ) {
                        logger.error( "SQLException in getArtist: " + sqle );
              }
               catch( Exception e ) {
                        logger.error( "Exception in getArtist: " + e );
              }
       }

      public static void main( String[] args ) throws Exception{            
            try {
                  ConfigProperties.getInstance( CONFIG_FILE );
                  
                  /* Get Log4j  LogConfig */
                  String sLogFile      = ConfigProperties.getProperty( log_config );
                  if( sLogFile != null ) {
                        PropertyConfigurator.configure( sLogFile );
                  }
            }
            catch( IOException ioe ) {
                  System.out.println( "IOException: " + ioe );
            }
            
            String sDate                  = null;
            java.util.Date trxDate      = null;
            if( args.length == 1 ) {
                  sDate      = args[0];
                  //trxDate      = GenericUtility.getDateFromString(
                  //      GenericUtility.DATE_FORMAT, sDate );
            }
            
            logger.info( "Starting Data Mirroring" );

            DataMirror agent = new DataMirror();
            // Connect DB
            agent.connectDBSource();
            agent.connectDBTarget();
            
            // Populate content_2
            int iIndex      = 0;
            int iLimit      = 1000;
            int iResult      = 0;
            do {
                  iResult      = agent.populateContent( trxDate, iIndex, iLimit );
                  logger.info( "content_2: " + iResult );                  
                  iIndex      = iIndex + iLimit;
            }
            while( iResult == iLimit );
            
            // Disconnect DB
            agent.disconnectDBSource();
            agent.disconnectDBTarget();
            logger.info( "Data Mirroring done" );
      }
}

-----------------------------------------------
ConfigProperties.java (2nd file)
-----------------------------------------------
package com.db.util;

import java.util.Properties;
import java.io.*;

public final class ConfigProperties {
      private static ConfigProperties instance;

        //private static String file_properties       = null;
        private static String file_properties       = "wdb_mir.properties";
        private static Properties ppty                   = null;

      private ConfigProperties() {
            // private constructor            
      }

        /*
          * Get the instance of the SMSGatewayProperties.
          */
        public static ConfigProperties getInstance( String filename )
                  throws FileNotFoundException, IOException {
                              
            if( instance == null ) {

                if ( null == ppty ) {
                        try {
                          System.out.println( "LOADING properties......" );
                          ppty = new Properties();
                          FileInputStream in = new FileInputStream( filename );
                          ppty.load( in );
                          in.close();

                        }
                        catch( FileNotFoundException e ) {
                          throw new FileNotFoundException(
                                    "File - " + filename + " not found in the working directory" );
                        }
                  }
               }

            return instance;
        }

        static public String getProperty( String key ) {
                  
          String str = ppty.getProperty( key );
            
          if ( null == str ) {
                  System.out.println(
                  "Warning: attempt to get an non-existant value in property file: " + key );
            }

          return str;
        }
}

0
Comment
Question by:kennethcky
  • 13
  • 9
  • 6
28 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 11712781
Show us your log4j.properties file.
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11712785
From Apache site:
log4j tells me to initialize properly.
Logging output is written to a target by using an appender. If no appenders are attached to a category nor to any of its ancestors, you will get the following message when trying to log:

log4j: No appenders could be found for category (some.category.name).
log4j: Please initialize the log4j system properly.

Log4j does not have a default logging target. It is the user's responsibility to ensure that all categories can inherit an appender. This can be easily achieved by attaching an appender to the root category.

So try to add the appender.
Bye, Giant.
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11712810
You must configure it in the file you use for configure the Logger (PropertyConfigurator(sLogFile);)

0
 
LVL 12

Expert Comment

by:Giant2
ID: 11712819

Appender configuration syntax is:


# For appender named appenderName, set its class.
# Note: The appender name can contain dots.
log4j.appender.appenderName=fully.qualified.name.of.appender.class

# Set appender specific options.
log4j.appender.appenderName.option1=value1
...
log4j.appender.appenderName.optionN=valueN

For each named appender you can configure its Layout. The syntax for configuring an appender's layout is:


log4j.appender.appenderName.layout=fully.qualified.name.of.layout.class
log4j.appender.appenderName.layout.option1=value1
....
log4j.appender.appenderName.layout.optionN=valueN




see here for details:
http://logging.apache.org/log4cxx/manual/classlog4cxx_1_1PropertyConfigurator.html


Hope this help you.
Bye, Giant.
0
 

Author Comment

by:kennethcky
ID: 11712924
hi,

Really appreciated all your replies.....

Below is my properties file

-------------------------------
# For the general syntax of property based configuration files see the
# documenation of org.apache.log4j.PropertyConfigurator.

# The root category uses two appenders called A1 and R. Since no priority is
# specified, the root category assumes the default priority for root
# which is DEBUG in log4j. The root category is the only category that
# has a default priority. All other categories need not be assigned a
# priority in which case they inherit their priority from the
# hierarchy.

#log4j.rootCategory=, R

# Root logger set to DEBUG using the A2 appender defined above.
log4j.rootLogger=, R, E

# R is the RollingFileAppender that outputs to a rolling log
# file called web_app.log.
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=logs/g_w_por.log===> "Don't know correct or not"
log4j.appender.R.Threshold=DEBUG

# Define a pattern layout for the file.
# For more information on conversion characters (i.e. d,p,t,c,l,m,n)
# please see the PatternLayout class of the Log4j API.
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d [%c] %-5p - %m%n

# Set the max size of the file and the number of backup files
log4j.appender.R.MaxFileSize=500KB
log4j.appender.R.MaxBackupIndex=9

# E is the RollingFileAppender that outputs to a rolling log
# file called web_err.log.
log4j.appender.E=org.apache.log4j.RollingFileAppender
log4j.appender.E.File=logs/g_w_por_err.log
log4j.appender.E.Threshold=ERROR

# Define a pattern layout for the file.
# For more information on conversion characters (i.e. d,p,t,c,l,m,n)
# please see the PatternLayout class of the Log4j API.
log4j.appender.E.layout=org.apache.log4j.PatternLayout
log4j.appender.E.layout.ConversionPattern=%d [%c] %5p - %m%n

# Set the max size of the file and the number of backup files
log4j.appender.E.MaxFileSize=100KB
log4j.appender.E.MaxBackupIndex=9
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11712952
why you use:
rootCategory=, R
log4j.rootLogger=, R, E
there is a blank name.

log4j.appender.R.File=logs/g_w_por.log
is correct
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11712969
see the link I posted:

The syntax for configuring the root logger is:
log4j.rootLogger=[level], appenderName, appenderName, ...
This syntax means that an optional level can be supplied followed by appender names separated by commas.
The level value can consist of the string values OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL or a custom level value. A custom level value can be specified in the form level#classname.
If a level value is specified, then the root level is set to the corresponding level. If no level value is specified, then the root level remains untouched.

The root logger can be assigned multiple appenders.
Each appenderName (separated by commas) will be added to the root logger. The named appender is defined using the appender syntax defined above.
For non-root categories the syntax is almost the same:

log4j.logger.logger_name=[level|INHERITED|NULL], appenderName, appenderName,
...

The meaning of the optional level value is discussed above in relation to the root logger. In addition however, the value INHERITED can be specified meaning that the named logger should inherit its level from the logger hierarchy.
If no level value is supplied, then the level of the named logger remains untouched.
By default categories inherit their level from the hierarchy. However, if you set the level of a logger and later decide that that logger should inherit its level, then you should specify INHERITED as the value for the level value. NULL is a synonym for INHERITED.

Similar to the root logger syntax, each appenderName (separated by commas) will be attached to the named logger.
See the appender additivity rule in the user manual for the meaning of the additivity flag.

0
 
LVL 35

Expert Comment

by:girionis
ID: 11712999
I do not think you need the roolLogger. Try to put it into comments and add this line:

log4j.rootCategory=ERROR, stdout

and tell us if this helps.
0
 
LVL 35

Expert Comment

by:girionis
ID: 11713009
Also can you make sure that your properties fiel is called log4j.properties *all lowercase*?
0
 
LVL 35

Expert Comment

by:girionis
ID: 11713042
You will also need to add those lines (I think) for the stdout:

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11713052
>log4j.rootCategory=ERROR, stdout
as I told completely before.
;-)


log4j.appender.stdout...
log4j.appender.R...
it depends of the name you use in declaring the appenders.
0
 
LVL 35

Expert Comment

by:girionis
ID: 11713126
>log4j.appender.stdout...
>log4j.appender.R...
>it depends of the name you use in declaring the appenders.

True, it is just easier to copy/paste from my log4j.properties :)
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11713159
>it is just easier to copy/paste from my log4j.properties
???

I see you suggest, like a solution, to use stdout instead of R (used by kennethcky).
So I puntualize that "it depends of the name you use in declaring the appenders"
0
 
LVL 35

Expert Comment

by:girionis
ID: 11713237
>I see you suggest, like a solution, to use stdout instead of R (used by kennethcky).
>So I puntualize that "it depends of the name you use in declaring the appenders"

Nope. I suggested that *rootLogger* is not necessary and to use *rootCategory* instead. And since I copied the rootCategory from my properties file and I define "stdout" I also thought it will be nice to copy/paste the relevant lines as well. He might as well have used "R" instead.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 12

Expert Comment

by:Giant2
ID: 11713250
Ok. Now clear.
0
 

Author Comment

by:kennethcky
ID: 11732975
Hi all,

If referring to the error after running the java file above..
It will display the error as below
---------------------
Warning: attempt to get an non-existant value in property file: 2w_por_log4j.properties
---------------------

When it go into this line it will display above error.....
------------
 String sLogFile     = ConfigProperties.getProperty( log_config );
               if( sLogFile != null ) {
                    PropertyConfigurator.configure( sLogFile );
               }
-----------

Am I doing somelthng wrong here? Pls advice what I need to do to get it read the .properties
file....
Inside the properties file is the appender configuration ........


thanks

0
 
LVL 12

Expert Comment

by:Giant2
ID: 11733130
>attempt to get an non-existant value in property file: 2w_por_log4j.properties
so there is a property not specified.
Could you post what is now your property file?
0
 

Author Comment

by:kennethcky
ID: 11733191
Hi,

If you can take a look at my java code above...I got 2 properties files that as below:
*************************
protected final static String CONFIG_FILE       = "wdb_mir.properties";
protected final static String log_config       = "2g_w_por_log4j.properties";
*************************

So now it just not to be able to load or get the 2g_w_por_log4j.properties to work........
Would it be this line that creates problem?
*********************
ConfigProperties.getInstance( CONFIG_FILE );
*********************


2w_por_log4j.properties
-------------------------------------------------------------------------------------
# For the general syntax of property based configuration files see the
# documenation of org.apache.log4j.PropertyConfigurator.

# The root category uses two appenders called A1 and R. Since no priority is
# specified, the root category assumes the default priority for root
# which is DEBUG in log4j. The root category is the only category that
# has a default priority. All other categories need not be assigned a
# priority in which case they inherit their priority from the
# hierarchy.

#log4j.rootCategory=, R

# Root logger set to DEBUG using the A2 appender defined above.
# log4j.rootLogger=ERROR, R, E
log4j.rootLogger=WARN, stdout, E

# R is the RollingFileAppender that outputs to a rolling log
# file called web_app.log.
log4j.appender.stdout=org.apache.log4j.RollingFileAppender
log4j.appender.stdout.File=logs/2g_w_por.log
log4j.appender.stdout.Threshold=DEBUG

# Define a pattern layout for the file.
# For more information on conversion characters (i.e. d,p,t,c,l,m,n)
# please see the PatternLayout class of the Log4j API.
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout.layout.ConversionPattern=%d [%c] %-5p - %m%n
log4j.appender.stdout.layout.ConversionPattern=%-5p: %m%n

# Set the max size of the file and the number of backup files
log4j.appender.stdout.MaxFileSize=500KB
log4j.appender.stdout.MaxBackupIndex=9

# E is the RollingFileAppender that outputs to a rolling log
# file called web_err.log.
log4j.appender.E=org.apache.log4j.RollingFileAppender
log4j.appender.E.File=logs/2g_w_por_err.log
log4j.appender.E.Threshold=ERROR

# Define a pattern layout for the file.
# For more information on conversion characters (i.e. d,p,t,c,l,m,n)
# please see the PatternLayout class of the Log4j API.
log4j.appender.E.layout=org.apache.log4j.PatternLayout
#log4j.appender.E.layout.ConversionPattern=%d [%c] %5p - %m%n
log4j.appender.E.layout.ConversionPattern=%-5p: %m%n

# Set the max size of the file and the number of backup files
log4j.appender.E.MaxFileSize=100KB
log4j.appender.E.MaxBackupIndex=9

****************************************************************

wdb_mir.properties
--------------------------------------------
database.source.driver=com.mysql.jdbc.Driver
database.source.url=jdbc:mysql://100.202.20.100/cont
database.source.username=cont
database.source.password=cont
      
database.target.driver=com.mysql.jdbc.Driver
database.target.url=jdbc:mysql://100.202.20.100/cont2
database.target.username=cont
database.target.password=cont
0
 
LVL 35

Expert Comment

by:girionis
ID: 11733363
> Warning: attempt to get an non-existant value in property file

That's a warning, I would ignore it if it does not affect the functionallity.
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11733394
the problem is that you try to take the property "2w_por_log4j.properties" from wdb_mir.properties file.
So, try to put in wdb_mir.properties file an entry like:

2w_por_log4j.properties=something

Bye, Giant.
0
 

Author Comment

by:kennethcky
ID: 11733423
ya...i can ignore it actually...but the properties would be used to catch/store error messages as well as the records that been stored.

So ..I actually would like to know how to catch the log and put it into a log file.


To summarize what the java code will do ...is, it will be login to the database
as usual but just that it use .properties file to connect and then put the error
or any messages into a log file....


thanks
kenneth
0
 

Author Comment

by:kennethcky
ID: 11733432
Ya Giant2 you are right, but the
2w_por_log4j.properties
is a properlties file, so how to assign a value to a file?
0
 
LVL 12

Accepted Solution

by:
Giant2 earned 70 total points
ID: 11733447
If I see well your code, put in wdb_mir.properties file this entry:

2w_por_log4j.properties=2w_por_log4j.properties

I'll be go.

Giant.
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11733450

I think it'll be go.
0
 
LVL 35

Expert Comment

by:girionis
ID: 11733456
Why do you need to assign a value to a file? What exactly do you want to do with the 2w_por_log4j?
0
 

Author Comment

by:kennethcky
ID: 11750635
hi there,


it able to work now... thanks for your comments Giants2, girionis and others also...


thanks
0
 
LVL 35

Expert Comment

by:girionis
ID: 11750650
Glad we were of help :)
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11867770
Thank you.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now