Search code examples
javaeclipselinkmoxypersistence.xml

Disable internal logging of MOXy (eclipselink)


For a project I'm using MOXy in order to (un)marshal XML files, and I have some problem with it that I didn't have with the standard jaxb engine.

But here, I'll focus on a single issue: I want to disable the internal logging of eclipselink. For example, I have logging like:

[Fatal Error] input.xml:4:1: The end-tag for element type "name" must end with a '>' delimiter.

And I just don't want it. I tried many things but no luck. Maybe it's just that I'm not used to this all logging system and persistence thing, but I'd love some help.

I've followed: http://eclipse.org/eclipselink/documentation/2.5/jpa/extensions/p_logging_level.htm and https://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging

But I'm not sure how this whole persistence.xml thing work. I'm working on a standard Java Project, no web-app or anything, just a standard project. I tried to create in my resource directory :

META-INF/persistence.xml

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
    <persistence-unit name="test">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

        <properties>
            <property name="eclipselink.logging.level" value="OFF" />
        </properties>
    </persistence-unit>
</persistence>

But nothing changed. I tried to pass -Declipselink.logging.level=OFF, but no luck either. Do someone know what I'm doing wrong?

Thanks.


Solution

  • The logging you wish to disable is SAX Parser logging. The odds are that at the moment there is no way to disable this logging from within MOXy. I have filed a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=461829