001/**
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
004 *
005 * This program and the accompanying materials are dual-licensed under
006 * either the terms of the Eclipse Public License v1.0 as published by
007 * the Eclipse Foundation
008 *
009 *   or (per the licensee's choosing)
010 *
011 * under the terms of the GNU Lesser General Public License version 2.1
012 * as published by the Free Software Foundation.
013 */
014package ch.qos.logback.classic.issue.DarioCampagna;
015
016import ch.qos.cal10n.IMessageConveyor;
017import ch.qos.cal10n.MessageConveyor;
018import ch.qos.logback.classic.LoggerContext;
019import ch.qos.logback.classic.joran.JoranConfigurator;
020import ch.qos.logback.core.joran.spi.JoranException;
021import org.slf4j.LoggerFactory;
022import org.slf4j.Marker;
023import org.slf4j.MarkerFactory;
024import org.slf4j.cal10n.LocLogger;
025import org.slf4j.cal10n.LocLoggerFactory;
026
027import java.util.Locale;
028
029public class Main {
030    public static void main(String[] args) throws JoranException {
031
032        LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
033        context.reset();
034        JoranConfigurator joranConfigurator = new JoranConfigurator();
035        joranConfigurator.setContext(context);
036        joranConfigurator.doConfigure("src/test/java/ch/qos/logback/classic/issue/DarioCampagna/logback-marker.xml");
037        IMessageConveyor mc = new MessageConveyor(Locale.getDefault());
038        LocLoggerFactory llFactory_default = new LocLoggerFactory(mc);
039        LocLogger locLogger = llFactory_default.getLocLogger("defaultLocLogger");
040        Marker alwaysMarker = MarkerFactory.getMarker("ALWAYS");
041        locLogger.info(alwaysMarker, "This will always appear.");
042        locLogger.info("Hello!");
043    }
044}