當前位置: 首頁>>代碼示例>>Java>>正文


Java Logger類代碼示例

本文整理匯總了Java中org.codehaus.plexus.logging.Logger的典型用法代碼示例。如果您正苦於以下問題:Java Logger類的具體用法?Java Logger怎麽用?Java Logger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Logger類屬於org.codehaus.plexus.logging包,在下文中一共展示了Logger類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testLogger

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
public void testLogger()
{
    Logger log = new DependencySilentLog();
    String text = new String( "Text" );
    Throwable e = new RuntimeException();

    log.debug( text );
    log.debug( text, e );
    log.error( text );
    log.error( text, e );
    log.warn( text );
    log.warn( text, e );
    log.info( text );
    log.info( text, e );

    log.fatalError( text );
    log.fatalError( text, e );
    log.getChildLogger( text );
    log.getName();
    log.getThreshold();
    log.isDebugEnabled();
    log.isErrorEnabled();
    log.isFatalErrorEnabled();
    log.isInfoEnabled();
    log.isWarnEnabled();
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:27,代碼來源:TestSilentLog.java

示例2: testAfterSessionStart_nullRevision

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
@Test
public void testAfterSessionStart_nullRevision()
        throws MavenExecutionException,
        RevisionGeneratorException {
    String revision = null;
    exceptions.expect(MavenExecutionException.class);
    exceptions.expectMessage("RevisionGenerator returned a null revision value");
    exceptions.expectCause(IsInstanceOf.any(RevisionGeneratorException.class));
    when(revisionGenerator.getRevision()).thenReturn(revision);

    try {
        item.afterSessionStart(session);
    } finally {
        verify(revisionGenerator).init(eq(session), any(Logger.class));
        verify(revisionGenerator).getRevision();
        verifyNoMoreInteractions(revisionGenerator);
        verifyZeroInteractions(session);
        verifyZeroInteractions(pluginMerger);
        verifyZeroInteractions(plugins);
    }
}
 
開發者ID:IG-Group,項目名稱:cdversion-maven-extension,代碼行數:22,代碼來源:CDVersionLifecycleParticipantTest.java

示例3: afterSessionStart_initThrowsRevisionGeneratorException

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
@Test
public void afterSessionStart_initThrowsRevisionGeneratorException()
        throws MavenExecutionException,
        RevisionGeneratorException {

    RevisionGeneratorException exception = new RevisionGeneratorException("msg", new RuntimeException("dummy sub cause"));

    exceptions.expect(MavenExecutionException.class);
    exceptions.expectMessage(exception.getMessage());
    exceptions.expectCause(IsEqual.equalTo(exception));
    doThrow(exception).when(revisionGenerator).init(eq(session), any(Logger.class));

    try {
        item.afterSessionStart(session);
    } finally {
        verify(revisionGenerator).init(eq(session), any(Logger.class));
    }
}
 
開發者ID:IG-Group,項目名稱:cdversion-maven-extension,代碼行數:19,代碼來源:CDVersionLifecycleParticipantTest.java

示例4: afterSessionStart_initThrowsRuntimeException

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
@Test
public void afterSessionStart_initThrowsRuntimeException()
        throws MavenExecutionException,
        RevisionGeneratorException {

    RuntimeException exception = new RuntimeException("random exception");

    exceptions.expect(MavenExecutionException.class);
    exceptions.expectMessage("Unexpected Exception during RevisionGenerator Initialisation");
    exceptions.expectCause(IsEqual.equalTo(exception));
    doThrow(exception).when(revisionGenerator).init(eq(session), any(Logger.class));

    try {
        item.afterSessionStart(session);
    } finally {
        verify(revisionGenerator).init(eq(session), any(Logger.class));
    }
}
 
開發者ID:IG-Group,項目名稱:cdversion-maven-extension,代碼行數:19,代碼來源:CDVersionLifecycleParticipantTest.java

示例5: SetupsMojoTestHelper

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
public SetupsMojoTestHelper( AbstractSetupsMojo mojo ) throws IOException {
   this.workingDir = new File( System.getProperty( "java.io.tmpdir" ), "unit_test_working" );

   this.mojo = mojo;

   this.mojo.workingDir = this.workingDir.getCanonicalPath();
   this.mojo.root = FitNesseHelper.DEFAULT_ROOT;
   this.mojo.project = new MavenProject();
   this.mojo.project.setFile( new File( getClass().getResource( "pom.xml" ).getPath() ) );
   this.mojo.pluginDescriptor = new PluginDescriptor();
   this.mojo.pluginManager = mock( BuildPluginManager.class );
   this.mojo.session = mock( MavenSession.class );

   this.logStream = new ByteArrayOutputStream();
   this.mojo.setLog( new DefaultLog( new PrintStreamLogger( Logger.LEVEL_INFO, "test", new PrintStream( this.logStream ) ) ) );
}
 
開發者ID:ZsZs,項目名稱:FitNesseLauncher,代碼行數:17,代碼來源:SetupsMojoTestHelper.java

示例6: execute

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
public static void execute( Commandline cl, Logger logger )
    throws NativeBuildException
{
    int ok;

    try
    {
        DefaultConsumer stdout = new DefaultConsumer();

        DefaultConsumer stderr = stdout;

        logger.info( cl.toString() );

        ok = CommandLineUtils.executeCommandLine( cl, stdout, stderr );
    }
    catch ( CommandLineException ecx )
    {
        throw new NativeBuildException( "Error executing command line", ecx );
    }

    if ( ok != 0 )
    {
        throw new NativeBuildException( "Error executing command line. Exit code:" + ok );
    }
}
 
開發者ID:mojohaus,項目名稱:maven-native,代碼行數:26,代碼來源:CommandLineUtil.java

示例7: UnpackedLibHelper

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
public UnpackedLibHelper ( ArtifactResolverHelper artifactResolverHelper, MavenProject project, Logger log,
                           File unpackedLibsFolder )
{
    this.artifactResolverHelper = artifactResolverHelper;
    if ( unpackedLibsFolder != null )
    {
        // if absolute then use it.
        // if relative then make it relative to the basedir of the project.
        this.unpackedLibsDirectory = unpackedLibsFolder.isAbsolute()
                ? unpackedLibsFolder
                : new File ( project.getBasedir(), unpackedLibsFolder.getPath() );
    }
    else
    {
        // If not specified then default to target/unpacked-libs
        final File targetFolder = new File ( project.getBuild().getDirectory() );
        this.unpackedLibsDirectory = new File ( targetFolder, "unpacked-libs" );
    }
    this.log = log;
}
 
開發者ID:simpligility,項目名稱:android-ndk-maven-plugin,代碼行數:21,代碼來源:UnpackedLibHelper.java

示例8: getThreshold

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
@Override
public int getThreshold()
{
    if ( delegate.isErrorEnabled() )
    {
        return Logger.LEVEL_ERROR;
    }
    else if ( delegate.isWarnEnabled() )
    {
        return Logger.LEVEL_WARN;
    }
    else if ( delegate.isInfoEnabled() )
    {
        return Logger.LEVEL_INFO;
    }

    return Logger.LEVEL_DEBUG;
}
 
開發者ID:simpligility,項目名稱:android-ndk-maven-plugin,代碼行數:19,代碼來源:MavenToPlexusLogAdapter.java

示例9: ArtifactResolverHelper

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
public ArtifactResolverHelper( ArtifactResolver artifactResolver, Logger log,
                              final List<ArtifactRepository> remoteArtifactRepositories )
{
    this.artifactResolver = artifactResolver;
    this.log = log;
    this.remoteArtifactRepositories = remoteArtifactRepositories;
}
 
開發者ID:simpligility,項目名稱:android-ndk-maven-plugin,代碼行數:8,代碼來源:ArtifactResolverHelper.java

示例10: getMavenLogLevel

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
private int getMavenLogLevel()
{
    switch (logLevel)
    {
        case "DEBUG":
            return Logger.LEVEL_DEBUG;
        case "WARN":
            return Logger.LEVEL_WARN;
        case "ERROR":
            return Logger.LEVEL_ERROR;
        case "FATAL":
            return Logger.LEVEL_FATAL;
        case "DISABLED":
            return Logger.LEVEL_DISABLED;
        case "INFO":
        default:
            return Logger.LEVEL_INFO;
    }
}
 
開發者ID:alexcojocaru,項目名稱:elasticsearch-maven-plugin,代碼行數:20,代碼來源:AbstractElasticsearchBaseMojo.java

示例11: tar

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
private static File tar(Set<File> files, String folder) throws IOException {
    TarArchiver tarArchive = new TarArchiver();
    tarArchive.enableLogging(new ConsoleLogger(Logger.LEVEL_DISABLED, "console"));
    for (File file : files) {
        // The starting ./ in the folder name is required for Heroku to be able to unpack the files correctly.
        if (file.isFile()) {
            tarArchive.addFile(file, "./" + folder + "/" + file.getName());
        } else if (file.isDirectory()) {
            tarArchive.addDirectory(file, "./" + folder + "/" + file.getName() + "/");
        }
    }

    File tarFile = File.createTempFile("TarGzArchive", ".tar");
    tarArchive.setDestFile(tarFile);
    tarArchive.createArchive();

    return tarFile;
}
 
開發者ID:Lugribossk,項目名稱:dropwizard-experiment,代碼行數:19,代碼來源:TarGzArchive.java

示例12: init

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
@Override
public void init(MavenSession session, Logger logger) throws RevisionGeneratorException {
    Git git = null;
    try {
        if (session.getExecutionRootDirectory() == null) {
            revision = "1.0-SNAPSHOT";
            dirty = true;
        } else {
            File gitDir = new FileRepositoryBuilder()
                    .findGitDir(new F‌ile(session.getExecutionRootDirectory()))
                    .getGitDir();
            if (gitDir != null && gitDir.exists()) {
                git = Git.open(gitDir);
                init(git, logger);
            } else {
                revision = "1.0-SNAPSHOT";
                dirty = true;
            }
        }
    } catch (IOException ex) {
        throw new RevisionGeneratorException("Issue opening Git repository for the project", ex);
    } finally {
        if (git != null) {
            git.close();
        }
    }
}
 
開發者ID:IG-Group,項目名稱:cdversion-maven-extension,代碼行數:28,代碼來源:GitRevisionGenerator.java

示例13: testAfterSessionStart_withRevision

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
@Test
@Parameters({
    "false, 20160101-133423-abcdefg, false",
    "false, 20160101-133423-abcdefg, true",
    "true, 20160101-133423-abcdefg-SNPASHOT, false",
    "true, 20160101-133423-abcdefg-SNAPSHOT, true",})
public void testAfterSessionStart_withRevision(boolean dirty, String revision, boolean failSnapshot)
        throws MavenExecutionException,
        RevisionGeneratorException {
    Properties userProperties = new Properties();
    userProperties.put("cdversion.snapshot.fail", String.valueOf(failSnapshot));

    if (dirty && failSnapshot) {
        exceptions.expect(MavenExecutionException.class);
    }

    when(session.getUserProperties()).thenReturn(userProperties);
    when(revisionGenerator.getRevision()).thenReturn(revision);
    when(revisionGenerator.isDirty()).thenReturn(dirty);

    try {
        item.afterSessionStart(session);

        Assert.assertEquals("UserProperties.Size", 2, userProperties.size());
        Assert.assertNotNull("UserProperties[revision]", userProperties.get("revision"));
        Assert.assertEquals("UserProperties[revision]", revision, userProperties.get("revision"));
    } finally {
        verify(session).getUserProperties();
        verify(revisionGenerator).init(eq(session), any(Logger.class));
        verify(revisionGenerator).isDirty();
        verify(revisionGenerator).getRevision();
        verifyNoMoreInteractions(session);
        verifyNoMoreInteractions(revisionGenerator);
        verifyZeroInteractions(pluginMerger);
        verifyZeroInteractions(plugins);
    }
}
 
開發者ID:IG-Group,項目名稱:cdversion-maven-extension,代碼行數:38,代碼來源:CDVersionLifecycleParticipantTest.java

示例14: newShader

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
private static DefaultShader newShader()
{
    DefaultShader s = new DefaultShader();

    s.enableLogging( new ConsoleLogger( Logger.LEVEL_INFO, "TEST" ) );

    return s;
}
 
開發者ID:javiersigler,項目名稱:apache-maven-shade-plugin,代碼行數:9,代碼來源:DefaultShaderTest.java

示例15: setUp

import org.codehaus.plexus.logging.Logger; //導入依賴的package包/類
protected void setUp()
    throws Exception
{
    super.setUp();

    LoggerManager loggerManager = (LoggerManager) lookup( LoggerManager.ROLE );

    loggerManager.setThreshold( Logger.LEVEL_DEBUG );
}
 
開發者ID:nkasvosve,項目名稱:beyondj,代碼行數:10,代碼來源:ScriptGeneratorBackgroundTest.java


注:本文中的org.codehaus.plexus.logging.Logger類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。