Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
PropertyConfigurator
March 3, 2016
5:52, EET
Avatar
pramanj
Member
Members
Forum Posts: 86
Member Since:
October 21, 2014
sp_UserOfflineSmall Offline

Where is the PropertyConfigurator’s “log.properties” file being used? I dont see it being used anywhere in the sampleConsoleClient application! Is it used in the libraries (jars)
When I comment it out I get the following warnings:
log4j:WARN No appenders could be found for logger (com.prosysopc.ua.UaApplication).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4…..l#noconfig for more info.

What is the implication of excluding it from declarations? Will it overwrite the log file on every restart of the application?
The reason I want to comment it in my application is that its not going forward beyond the code

PropertyConfigurator.configureAndWatch(SampleConsoleClient.class.getResource(“log.properties”).getFile(), 5000);

But when I comment it , it goes ahead.

Any comments will be appreciated.

PRAMANJ.

March 3, 2016
7:38, EET
Avatar
Heikki Tahvanainen
Member
Members
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hi,

The SDK uses slf4j logging facade. The slf4j enables application developers to choose the logging library flexibly. The sample applications in turn use log4j logging library. This means that to use the sample applications, your classpath needs to contain slf4j library, slf4j bridge and log4j logging library. For example: slf4j-api-1.7.7.jar, slf4j-log4j12-1.7.7.jar, log4j-1.2.17.jar.

The log.properties file in the sample applications is used to configure the log4j logging system. See examples of log.properties file in folders samples\com\prosysopc\ua\samples\client and samples\com\prosysopc\ua\samples\server

March 3, 2016
10:30, EET
Avatar
pramanj
Member
Members
Forum Posts: 86
Member Since:
October 21, 2014
sp_UserOfflineSmall Offline

Ok. But should the “log.properties” file preexist in the source folder? When I use the libraries in my application, the “log.properties” file doesn’t exist in my src folder and my application hangs at the “PropertyConfigurator.configureAndWatch(SampleConsoleClient.class.getResource(“log.properties”).getFile(), 5000);” call! When I comment it out it progresses but gives warning at run time as mentioned above.

Is it OK to proceed with commenting out this line, if I don’t intend to log any info in the file?
regards
PRAMANJ

March 3, 2016
11:31, EET
Avatar
Heikki Tahvanainen
Member
Members
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hello,

The file must pre-exist. Also, note that this code is now attempting to fetch the log.properties from the same path where SampleConsoleClient resides.

You should also consider familiarizing yourself with slf4j and log4j documentation.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
16 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 738

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1524

Posts: 6450

Newest Members:

jonathonmcintyre, fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1