Package org.apache.logging.log4j.spi

Examples of org.apache.logging.log4j.spi.MutableThreadContextStack


        Level level = Level.TRACE;
        Message data = new SimpleMessage("message");
        Throwable t = new InternalError("not a real error");
        Map<String, String> map = new HashMap<String, String>();
        map.put("key", "value");
        ContextStack contextStack = new MutableThreadContextStack(Arrays.asList("a", "b"));
        String threadName = "main";
        StackTraceElement location = null;
        long currentTimeMillis = 12345;
        evt.setValues(null, loggerName, marker, fqcn, level, data, t, map,
                contextStack, threadName, location, currentTimeMillis);
View Full Code Here


    }

    @Test
    public void testConvert01() {
        ThreadContext.clearStack();
        final ThreadContext.ContextStack stack = new MutableThreadContextStack(
                Arrays.asList("value1", "another2"));

        final String converted = this.converter.convertToDatabaseColumn(stack);

        assertNotNull("The converted value should not be null.", converted);

        final ThreadContext.ContextStack reversed = this.converter
                .convertToEntityAttribute(converted);

        assertNotNull("The reversed value should not be null.", reversed);
        assertEquals("The reversed value is not correct.", stack.asList(),
                reversed.asList());
    }
View Full Code Here

    }

    @Test
    public void testConvert02() {
        ThreadContext.clearStack();
        final ThreadContext.ContextStack stack = new MutableThreadContextStack(
                Arrays.asList("key1", "value2", "my3"));

        final String converted = this.converter.convertToDatabaseColumn(stack);

        assertNotNull("The converted value should not be null.", converted);

        final ThreadContext.ContextStack reversed = this.converter
                .convertToEntityAttribute(converted);

        assertNotNull("The reversed value should not be null.", reversed);
        assertEquals("The reversed value is not correct.", stack.asList(),
                reversed.asList());
    }
View Full Code Here

    }

    @Test
    public void testConvertToDatabaseColumn01() {
        final ThreadContext.ContextStack stack = new MutableThreadContextStack(
                Arrays.asList("value1", "another2"));

        assertEquals("The converted value is not correct.", "value1\nanother2",
                this.converter.convertToDatabaseColumn(stack));
    }
View Full Code Here

                this.converter.convertToDatabaseColumn(stack));
    }

    @Test
    public void testConvertToDatabaseColumn02() {
        final ThreadContext.ContextStack stack = new MutableThreadContextStack(
                Arrays.asList("key1", "value2", "my3"));

        assertEquals("The converted value is not correct.",
                "key1\nvalue2\nmy3",
                this.converter.convertToDatabaseColumn(stack));
View Full Code Here

        new SimpleMessage("Test"), new RuntimeException("test"), map, null, "none",
        new StackTraceElement("MapRewritePolicyTest", "setupClass", "MapRewritePolicyTest", 28), 2);
        logEvent1 = new Log4jLogEvent("test", null, "MapRewritePolicyTest.setupClass()", Level.ERROR,
        new MapMessage(map), null, map, null, "none",
        new StackTraceElement("MapRewritePolicyTest", "setupClass", "MapRewritePolicyTest", 29), 2);
    final ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
        logEvent2 = new Log4jLogEvent("test", MarkerManager.getMarker("test"), "MapRewritePolicyTest.setupClass()",
        Level.TRACE, new StructuredDataMessage("test", "Nothing", "test", map), new RuntimeException("test"), null,
        stack, "none", new StackTraceElement("MapRewritePolicyTest",
        "setupClass", "MapRewritePolicyTest", 30), 20000000);
        logEvent3 = new Log4jLogEvent("test", null, "MapRewritePolicyTest.setupClass()", Level.ALL, new MapMessage(map),
View Full Code Here

        new SimpleMessage("Test"), new RuntimeException("test"), map, null, "none",
        new StackTraceElement("MapRewritePolicyTest", "setupClass", "MapRewritePolicyTest", 28), 2);
    logEvent1 = new Log4jLogEvent("test", null, "MapRewritePolicyTest.setupClass()", Level.ERROR,
        new MapMessage(map), null, map, null, "none",
        new StackTraceElement("MapRewritePolicyTest", "setupClass", "MapRewritePolicyTest", 29), 2);
    ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
    logEvent2 = new Log4jLogEvent("test", MarkerManager.getMarker("test"), "MapRewritePolicyTest.setupClass()",
        Level.TRACE, new StructuredDataMessage("test", "Nothing", "test", map), new RuntimeException("test"), null,
        stack, "none", new StackTraceElement("MapRewritePolicyTest",
        "setupClass", "MapRewritePolicyTest", 30), 20000000);
    logEvent3 = new Log4jLogEvent("test", null, "MapRewritePolicyTest.setupClass()", Level.ALL, new MapMessage(map),
View Full Code Here

    }

    @Test
    public void testConvert01() {
        ThreadContext.clearStack();
        ThreadContext.ContextStack stack = new MutableThreadContextStack(
                Arrays.asList("value1", "another2"));

        String converted = this.converter.convertToDatabaseColumn(stack);

        assertNotNull("The converted value should not be null.", converted);

        ThreadContext.ContextStack reversed = this.converter
                .convertToEntityAttribute(converted);

        assertNotNull("The reversed value should not be null.", reversed);
        assertEquals("The reversed value is not correct.", stack.asList(),
                reversed.asList());
    }
View Full Code Here

    }

    @Test
    public void testConvert02() {
        ThreadContext.clearStack();
        ThreadContext.ContextStack stack = new MutableThreadContextStack(
                Arrays.asList("key1", "value2", "my3"));

        String converted = this.converter.convertToDatabaseColumn(stack);

        assertNotNull("The converted value should not be null.", converted);

        ThreadContext.ContextStack reversed = this.converter
                .convertToEntityAttribute(converted);

        assertNotNull("The reversed value should not be null.", reversed);
        assertEquals("The reversed value is not correct.", stack.asList(),
                reversed.asList());
    }
View Full Code Here

    }

    @Test
    public void testConvertToDatabaseColumn01() {
        ThreadContext.ContextStack stack = new MutableThreadContextStack(
                Arrays.asList("value1", "another2"));

        assertEquals("The converted value is not correct.", "value1\nanother2",
                this.converter.convertToDatabaseColumn(stack));
    }
View Full Code Here

TOP

Related Classes of org.apache.logging.log4j.spi.MutableThreadContextStack

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.