当前位置: 首页>>代码示例>>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;未经允许,请勿转载。