Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1069191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:23:06+00:00 2026-05-16T20:23:06+00:00

I have following XML configration i would like to convert to java property file.

  • 0

I have following XML configration i would like to convert to java property file.

I am getting below error

log4j:WARN Failed to set property [filter] to value "org.apache.log4j.varia.DenyAllFilter".
log4j:ERROR Could not instantiate class [true].
java.lang.ClassNotFoundException: true
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at org.apache.log4j.helpers.Loader.loadClass(Loader.java:198)
    at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:326)
    at org.apache.log4j.PropertyConfigurator.parseAppenderFilters(PropertyConfigurator.java:881)
    at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:812)
    at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:735)
    at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:615)
    at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:502)
    at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:395)
    at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:403)
    at simpandfile.main(simpandfile.java:10)

My XML configration

  <filter class="org.apache.log4j.varia.StringMatchFilter">
    <param name="StringToMatch" value="FileNotfound" />
    <param name="AcceptOnMatch" value="true" />
  </filter>

  <filter class="org.apache.log4j.varia.LevelRangeFilter">
        <param name="LevelMin" value="ERROR"/>
        <param name="LevelMax" value="FATAL"/>
    </filter>

  <filter class="org.apache.log4j.varia.DenyAllFilter"/>

After converting the property file is as below. With XML configration it is working fine.

Property File

log4j.rootLogger=INFO, MAIL

log4j.appender.MAIL=org.apache.log4j.net.SMTPAppender
# here's where I specify the layout and the pattern

log4j.appender.MAIL.BufferSize=1
log4j.appender.MAIL.SMTPHost=xxx.example.com
log4j.appender.MAIL.From=xxx@example.com
log4j.appender.MAIL.To=xxx@example.com
log4j.appender.MAIL.Subject=Test Email.
log4j.appender.MAIL.threshold=error
log4j.appender.MAIL.layout=org.apache.log4j.PatternLayout
log4j.appender.MAIL.layout.ConversionPattern=[%d{ISO8601}]%n%n%-5p%n%n%c%n%n%m%n%n
log4j.appender.MAIL.filter=org.apache.log4j.varia.StringMatchFilter
log4j.appender.MAIL.filter.StringToMatch=Filenotfound
log4j.appender.MAIL.filter.AcceptOnMatch=true
log4j.appender.MAIL.filter=org.apache.log4j.varia.DenyAllFilter


log4j.logger.com.devdaily.myapp=DEBUG
log4j.logger.org.springframework=DEBUG

Please let me know how i can use StringToMatch in property file and specify

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:23:06+00:00Added an answer on May 16, 2026 at 8:23 pm

    Properties files don’t support filters. You’ll have to switch to an XML configuration.

    From the documentation of Filter :

    Note that filtering is only supported by the DOMConfigurator. The PropertyConfigurator does not support filters.


    Resources :

    • log4j – Filter

    On the same topic :

    • Why chose XML over properties files for Log4J configuration?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following log4j.xml configuration: <log4j:configuration> <appender name = CONSOLE class = org.apache.log4j.ConsoleAppender>
I have the following configuration file for NHibernate : <?xml version=1.0 encoding=utf-8 ?> <hibernate-configuration
I have following xml file: <ab> <![CDATA[ <table> <tbody> <tr> <th>abcdef</th> </tr> <tr> <p>
I have the following configuration for an admin menu item. I would like the
Assuming I have a sample configuration XML file that is the following: <?xml version=1.0?>
I would like to put some of the hibernate configuration in a property file
I have the following requirement: In C#2.0, Given a device configuration in xml format
I have following xml and I want to fetch the value of node which
I have following XML, and i wish to save its data in my SQL
I have following XML. I was able to remove all namespaces but not able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.