Giter VIP home page Giter VIP logo

logunit's People

Contributors

anuraaga avatar netmikey avatar sebastiankuehn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

logunit's Issues

Last release requires java 11

Recently release logunit-logback:1.1.1 publishes Gradle module file which declares that this module requires java 11:

      "attributes": {
        "org.gradle.category": "library",
        "org.gradle.dependency.bundling": "external",
        "org.gradle.jvm.version": 11,
        "org.gradle.libraryelements": "jar",
        "org.gradle.usage": "java-api"
      },

This contradicts README claim that java 8 is supported. Probably the easiest way to fix this is to configure java compiler in your build scripts with release=8 option: https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation

Get the diagnostic context in the event.

That would be cool to have the map of diagnostic context in the final log event. This is equivalent to ThreadContext Map in log4j2, and to MDC in logback.

That would allow to test that ThreadContext.put() and MDC.put is being called.

False assertions when running tests in parallel

Hi,

First, I would like to thank you for this project. It is nicely implemented and very useful.

I would like to report an issue when running the tests in parallel with the following properties:

junit.jupiter.execution.parallel.enabled = true
junit.jupiter.execution.parallel.mode.default = concurrent

Attaching a small project to reproduce - parallel-tests.zip

If I uncomment the @Execution(ExecutionMode.SAME_THREAD) on the ParallelTest class or use @ResourceLock("LogCapturer") on both test methods, everything works.

Run the tests by executing:

mvn clean test

BTW - I used Flogger which uses slf4j to log4j2

Thanks!

missing log events

I want to test Log4J2 messages and use logunit-core together with logunit-log4j2 (v2.0.0). Here is my test class:

import io.github.netmikey.logunit.api.LogCapturer;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.junit.jupiter.api.Assertions.*;

@TestMethodOrder(MethodOrderer.MethodName.class)
class LogTest {

    @RegisterExtension
    LogCapturer logCapturer = LogCapturer.create().captureForType(LogTest.class);

    private static final Logger log = LoggerFactory.getLogger(LogTest.class);

    @BeforeEach
    void createLog() {
        log.info("Test-Log created.");
    }

    @Test
    void getEvents() {
        //log.info("Get events.");
        assertFalse(logCapturer.getEvents().isEmpty());
    }

    @Test
    void testMessage() {
        //log.info("Test message.");
        logCapturer.assertContains("Test");
    }

}

I see the log ("Test-Log created.") but the tests fail. This is the same problem I have with real tests. Only in some cases the events are not empty.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.