0
votes

In my Mule app, I have added a custom appender to the log4j.properties specific to the app, and I have created a class called MyClass extending AppenderSkeleton. However, when I try to add:

log4j.appender.myCustomAppender=MyClass

I'm getting the following error:

log4j:ERROR Could not instantiate class [MyClass]

In the Mule project (in mule studio), the class is located at: myapp/src/main/java/MyClass.java and my log4j conf file is located in: myapp/src/main/resources/log4j.properties

I have set no particular package for the class, and I'm not sure how to point to the right class from the log4j.properties file. What is the correct way to ge to MyClass?

One important point to note, is that once the app is deployed as a standalone mule app, the path structure changes to:

[mule-dir]/apps/my-app/classes/MyClass.java

and:

[mule-dir]/apps/my-app/classes/log4j.properties

So hopefully there is a way to get to the class from both Mule Studio and the deployed app.

Thank you,

Thanks,

1

1 Answers

0
votes

You might not be able to get a custom appender to work in the Studio but it should work in the Standalone. The main problem is that the logger is initiated before the app. See here: Mule ESB 3.4.0 CE: Unable to find custom log4j appender in MuleStudio, but works in Mule Standalone