Home>

Help sort out, there is the following libraryand is descriptionhow to use it in your project, I did everything on took, but when starting, the following errors will appear

Exception in Thread "Main" java.lang.ExceptioninInitializererror
    AT Testm.Main (testm.java:8)
Caused by: Org.apache.logging.log4j.loggingException: log4j-slf4j-impl cannot be present with log4j-to-slf4j
    at org.apache.logging.slf4j.log4jloggerfactory.validatectextext (log4jloggerfactory.java:49)
    at org.apache.logging.slf4j.log4jloggerfactory.newlogger (log4jloggerfactory.java:39)
    at org.apache.logging.slf4j.log4jloggerfactory.newlogger (log4jloggerfactory.java:30)
    at org.apache.logging.log4j.spi.AbstractLoggeradapter.getLogger (abstractloggeradapter.java:3)
    at org.apache.logging.slf4j.log4jloggerfactory.getlogger (log4jloggerfactory.java:30)
    at org.slf4j.loggerfactory.getlogger (loggerfactory.java :58)
    at org.apache.logging.slf4j.slf4jloggercontext.getlogger (slf4jloggercontext.java:39)
    at org.apache.logging.log4j.spi.loggercontext.getlogger (loggercontext.java:99)
    at org.apache.logging.log4j.logmanager.getlogger (LogManager.java:99)
    at nl.basjes.parse.useragent.abstracturagentanalyzerdirect. <
Clinit >
(Abstracturagentanalyzerdirect.java:17)
    ... 1 more

how to eliminate them?

file pom.xml

<
? xml version= "1.0" encoding= "UTF-8"? >
≪
Project XMLNS= "http://maven.apache.org/pom/4.0.0"
         XMLNS: XSI= "http://www.w3.org/2001/xmlschema-Instance"
         XSI: Schemalocation= "http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    ≪
Modelversion >
4.0.0 <
/Modelversion >
    ≪
GroupID >
ORG.EXAMPLE <
/groupid >
    ≪
artifactid >
Test <
/artifactid >
    ≪
Version >
1.0-Snapshot <
/Version >
    ≪
Dependencies >
        ≪
DEPENDENCY >
            ≪
GroupID >
nl.basjes.parse.useragent <
/groupid >
            ≪
artifactid >
YAUAA <
/artifactid >
            ≪
Version >
6.0 <
/Version >
        ≪
/DEPENDENCY >
    ≪
/DEPENDENCIES >
    ≪
Properties >
        ≪
maven.compiler.source >
16 <
/maven.compiler.source>
        ≪
maven.compiler.target >
16 <
/maven.compiler.target>
    ≪
/Properties >
≪
/Project >

Java file

Import nl.basjes.parse.useragent.useragent;
Import nl.basjes.parse.useragent.useragentanaLyzer;
Public Class Testm {
    Public Static Void Main (String [] Args)
    {
        Useragentanalyzer uaa= useragentanalyzer
                .newBuilder ()
                .hidematcherloadStats ()
                .withcache (10,000)
                .build ();
        UseRAGENT AGENT= UAA.PARSE ("Mozilla /5.0 (Windows; U; Windows NT 5.1; EN-US; RV: 1.8.1.11) GECKO /20071127 Firefox /2.0.0.11");
        For (String FieldName: agent.getavailablefieldnamessorted ())
        {
            System.out.PrintLN ((fieldname + "="+ agent.getvalue (fieldname)));
        }
    }
}

Total Error Pattern