Skip to content

LoggingApplicationListener calls loggingSystem.cleanUp() after nested context was destroyed #4651

Closed
@toughpheeckouse

Description

@toughpheeckouse

Is it right way to cleanUp loggingSystem after nested context was destroyed?

I have next code:

migrationContext = new AnnotationConfigApplicationContext();

migrationContext.setParent(applicationContext);

.../*(some actions in migrationContext */

migrationContext.destroy(); // sends ContextClosedEvent to LoggingApplicationListener `

After that I can't get log messages from JUL.

What I'm doing wrong? Is it bug in LoggingApplicationListener or I use wrong way to create nested context?

As workaround - do not send ContextClosedEvent by nested context:

migrationContext = new AnnotationConfigApplicationContext()
{
    @Override
    public void publishEvent(ApplicationEvent event)
    {
        if (!(event instanceof ContextClosedEvent))
        {
            super.publishEvent(event);
        }
    }
};

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions