Skip to content

Add @Log annotation for injecting log file paths #10

@jamezp

Description

@jamezp

Add support for injecting WildFly log file paths using @ServerResource with a new @Log annotation.

Proposed API

@WildFlyTest
public class LogFileTest {
    
    @ServerResource
    @Log("server.log")
    private Path serverLog;
    
    @ServerResource
    @Log  // Defaults to "server.log"
    private Path defaultLog;
    
    @Test
    public void checkServerLog() {
        assertTrue(Files.exists(serverLog));
        // Can read/parse log file for test validation
    }
}

Use Cases

  • Validating specific log messages appear during tests
  • Checking for errors/warnings in logs
  • Performance testing by analyzing log timestamps
  • Debugging failing tests by examining log output

Implementation Notes

  • Path should resolve to ${jboss.home}/standalone/log/${logFileName} for standalone mode
  • For domain mode, might need @DomainServer qualifier to specify which server's logs
  • Consider supporting other log files like gc.log, audit.log, etc.

Related

Similar to how @JBossHome injects the WildFly home directory as a Path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions