This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line!
See this thread for details.
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

remove log4j appender from an API

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I hope the post is in the correct forum area.

I have a quite annoying problem, I have written an integration between two systems and after all I realize that log4j would be really good for logging.
And I just switched out my regular logger and appended log4j, but there is a problem with the API that I'm using, it has a log4j appender in the precompiled source. Is there a way to just remove that logger? I tried to remove is but with no luck, it still log in the wrong file with the wrong settings when the API has been used.

Any good ideas of how I can disable the API log4j appender?

Best Regards
Markus
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

In most cases, log4j takes all its configuration from an external file (often called "log4j.properties"). If that's the case here, then you should be able to replace the configuration that comes with the library with your own configuration.
 
Markus Andersson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

I have already made a log4j configuration, and added the set the log4j in debug mode here is the output from the console when I run the application.

lo.html is "my log file" and my_PM.html is "API log file" which I don't mind if it's created or not but it's steeling my log entries.
The problem is that the API I'm forced to use is creating a new log4j appender and all logs are after that handled by that appender.
The API don't have a log4j.properties or log4j.XML files. I guess it's compiled into the code.

I have realized that the new Appender from the API is called A, then I tried to remove that appender


But it stills uses the A appender. I can't access the A appender from the API it's automatically used by the API.

Any good suggestions?
//
Markus
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

Have you tried setting the root configuration, e.g. (From a sample log4j.xml)

 
I am mighty! And this is a mighty small ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic