• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Log4J created two log files but should have only done one

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This properties file for some reason creates two log files when I expect one. What am I missing?

It creates: C:\jAPRSSend\jAPRSSend.log and C:\jAPRSSend\jAPRSSendjAPRSSend.log. The second log is empty the first one gets everything. I do not want the second one. Still new to Log4J, so I am wondering what is going on. Obviously, this is on Windows and I am going to test on Linux.



Thanks for looking at this for me.

Mike
 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That has got me stumped, can you try on Linux and post the results here?
 
Mike Bates
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tried it on Linux and get a file called C:jAPRSSendjAPRSSend.log only though no log information shows in it.

For each class, I have



and for the primary class



Mike
 
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

On linux, what is your ${user.dir} set to? Linux has a different file system structure than Windows. Linux doesn't have a C drive.
 
Mike Bates
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, ${user.dir} is /home/mbates/dist on Linux and found a file called dist/jAPRSSend.log in the /home/mbates directory. The file C:jAPRSSendjAPRSSend.log created with it in the /home/mbates/dist directory.


With the above change, after deleting all log files, I still get two log files now in /home/mbates/dist. One called jAPRSSend.log and one called C:jAPRSSendjAPRSSend.log.

I am using log4j-1.2.15.jar in my lib directory. [UPDATED] Just tried 1.2.16 with the same results.

Mike
 
Martijn Verburg
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't have any other log4j.properties files or log4j.xml files floating around?
 
Mike Bates
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martijn,

You hit the nail no the head. It looks like I had a log4j.properties within the Jar file and it was using that first. Thought I had deleted it a long time ago.

Something that caused me some low level frustration for the last couple of weeks and it was simple.

Thanks
Mike
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For issues like these, I usually set the following Java system property:



That prints out useful information on how log4j is trying to configure itself.
 
Martijn Verburg
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome and it most definitely happens to all of us!
 
    Bookmark Topic Watch Topic
  • New Topic