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
Moderator
Members

Moderators
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
Moderator
Members

Moderators
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: 518

Currently Online:
7 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 682

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

digitechroshni, LouieWreve, Kickbiche, karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1