在Intellij中遇到了与log4j日志文件格式有关的问题。

huangapple go评论71阅读模式
英文:

Getting issue in Intellij with log4j log file format

问题

I was trying to generate log file in Intellij using Log4j2. I made properties file for Log4j2 and configured it in the base class of my framework. My logs are getting generated in my project root directory without any issue. But when I am opening the log file, then Intellij is showing me an error for the Log format. Can anyone help me resolve this issue in Intellij?

Here is my log4j2.properties file:

//name=PropertiesConfig
property.filename = logs
appenders = console, file
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
appender.file.type = File
appender.file.name = LOGFILE
appender.file.fileName=${filename}/propertieslogs.log
appender.file.layout.type=PatternLayout
appender.file.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
appender.file.append=true

loggers=file
logger.file.name=com.framework
logger.file.level = debug
logger.file.appenderRefs = file
logger.file.appenderRef.file.ref = LOGFILE
rootLogger.level = debug
rootLogger.appenderRefs = stdout
rootLogger.appenderRef.stdout.ref = STDOUT

Here are my console logs:

Testing started at 4:09 PM ...
/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/bin/java -Dorg.jetbrains.run.directory=/Users/keshavmac/IdeaProjects/com.CucumberHybrid/src/test/java/com/framework/features -javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=58681:/Applications/IntelliJ IDEA CE.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/lib/tools.jar:/Users/keshavmac/IdeaProjects/com.CucumberHybrid/target/test-classes:/Users/keshavmac/IdeaProjects/com.CucumberHybrid/target/classes:/Users/keshavmac/.m2/repository/org/apache/logging/log4j/log4j-core/2.13.3/log4j-core-2.13.3.jar:/Users/keshavmac/.m2/repository/org/apache/logging/log4j/log4j-api/2.13.3/log4j-api-2.13.3.jar:/Users/keshavmac/.m2/repository/io/github/bonigarcia/webdrivermanager/3.8.1/webdrivermanager-3.8.1.jar:/Users/keshavmac/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/Users/keshavmac/.m2/repository/commons-io/commons-io/2.6/commons-io-2.6.jar:/Users/keshavmac/.m2/repository/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar:/Users/keshavmac/.m2/repository/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar:/Users/keshavmac/.m2/repository/org/apache/httpcomponents/httpclient/

<details>
<summary>英文:</summary>

I was trying to generate log file in Intellij using Log4j2. I made properties file for Log4j2 and configured it in the base class of my framework. My logs are getting generated in my project root directory without any issue. But when I am opening th log file then Intellij is showing me an error for Log format so can anyone help me to resolve this issue of Intellij.

Here is my log4j2.properties file:-

    //name=PropertiesConfig
    property.filename = logs
    appenders = console, file
    appender.console.type = Console
    appender.console.name = STDOUT
    appender.console.layout.type = PatternLayout
    appender.console.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
    appender.file.type = File
    appender.file.name = LOGFILE
    appender.file.fileName=${filename}/propertieslogs.log
    appender.file.layout.type=PatternLayout
    appender.file.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
    appender.file.append=true
    
    loggers=file
    logger.file.name=com.framework
    logger.file.level = debug
    logger.file.appenderRefs = file
    logger.file.appenderRef.file.ref = LOGFILE
    rootLogger.level = debug
    rootLogger.appenderRefs = stdout
    rootLogger.appenderRef.stdout.ref = STDOUT


Here are my console logs :- 

    Testing started at 4:09 PM ...
    /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/bin/java -Dorg.jetbrains.run.directory=/Users/keshavmac/IdeaProjects/com.CucumberHybrid/src/test/java/com/framework/features -javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=58681:/Applications/IntelliJ IDEA CE.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/lib/tools.jar:/Users/keshavmac/IdeaProjects/com.CucumberHybrid/target/test-classes:/Users/keshavmac/IdeaProjects/com.CucumberHybrid/target/classes:/Users/keshavmac/.m2/repository/org/apache/logging/log4j/log4j-core/2.13.3/log4j-core-2.13.3.jar:/Users/keshavmac/.m2/repository/org/apache/logging/log4j/log4j-api/2.13.3/log4j-api-2.13.3.jar:/Users/keshavmac/.m2/repository/io/github/bonigarcia/webdrivermanager/3.8.1/webdrivermanager-3.8.1.jar:/Users/keshavmac/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/Users/keshavmac/.m2/repository/commons-io/commons-io/2.6/commons-io-2.6.jar:/Users/keshavmac/.m2/repository/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar:/Users/keshavmac/.m2/repository/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar:/Users/keshavmac/.m2/repository/org/apache/httpcomponents/httpclient/4.5.6/httpclient-4.5.6.jar:/Users/keshavmac/.m2/repository/org/apache/httpcomponents/httpcore/4.4.10/httpcore-4.4.10.jar:/Users/keshavmac/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/Users/keshavmac/.m2/repository/commons-codec/commons-codec/1.10/commons-codec-1.10.jar:/Users/keshavmac/.m2/repository/org/rauschig/jarchivelib/1.0.0/jarchivelib-1.0.0.jar:/Users/keshavmac/.m2/repository/org/apache/commons/commons-compress/1.18/commons-compress-1.18.jar:/Users/keshavmac/.m2/repository/org/jsoup/jsoup/1.11.3/jsoup-1.11.3.jar:/Users/keshavmac/.m2/repository/org/testng/testng/6.14.3/testng-6.14.3.jar:/Users/keshavmac/.m2/repository/com/beust/jcommander/1.72/jcommander-1.72.jar:/Users/keshavmac/.m2/repository/org/apache-extras/beanshell/bsh/2.0b6/bsh-2.0b6.jar:/Users/keshavmac/.m2/repository/io/cucumber/cucumber-java/6.1.2/cucumber-java-6.1.2.jar:/Users/keshavmac/.m2/repository/io/cucumber/cucumber-core/6.1.2/cucumber-core-6.1.2.jar:/Users/keshavmac/.m2/repository/io/cucumber/cucumber-gherkin/6.1.2/cucumber-gherkin-6.1.2.jar:/Users/keshavmac/.m2/repository/io/cucumber/cucumber-gherkin-messages/6.1.2/cucumber-gherkin-messages-6.1.2.jar:/Users/keshavmac/.m2/repository/io/cucumber/messages/12.1.1/messages-12.1.1.jar:/Users/keshavmac/.m2/repository/io/cucumber/tag-expressions/3.0.0/tag-expressions-3.0.0.jar:/Users/keshavmac/.m2/repository/io/cucumber/cucumber-expressions/10.2.1/cucumber-expressions-10.2.1.jar:/Users/keshavmac/.m2/repository/io/cucumber/datatable/3.3.1/datatable-3.3.1.jar:/Users/keshavmac/.m2/repository/io/cucumber/cucumber-plugin/6.1.2/cucumber-plugin-6.1.2.jar:/Users/keshavmac/.m2/repository/io/cucumber/docstring/6.1.2/docstring-6.1.2.jar:/Users/keshavmac/.m2/repository/io/cucumber/html-formatter/6.0.3/html-formatter-6.0.3.jar:/Users/keshavmac/.m2/repository/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar:/Users/keshavmac/.m2/repository/net/masterthought/cucumber-reporting/5.3.0/cucumber-reporting-5.3.0.jar:/Users/keshavmac/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.10.1/jackson-databind-2.10.1.jar:/Users/keshavmac/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.10.1/jackson-annotations-2.10.1.jar:/Users/keshavmac/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.10.1/jackson-core-2.10.1.jar:/Users/keshavmac/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.10.1/jackson-datatype-jsr310-2.10.1.jar:/Users/keshavmac/.m2/repository/org/apache/velocity/velocity-engine-core/2.1/velocity-engine-core-2.1.jar:/Users/keshavmac/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/Users/keshavmac/.m2/repository/joda-time/joda-time/2.10.5/joda-time-2.10.5.jar:/Users/keshavmac/.m2/repository/org/codehaus/plexus/plexus-utils/3.3.0/plexus-utils-3.3.0.jar:/Users/keshavmac/.m2/repository/com/googlecode/owasp-java-html-sanitizer/owasp-java-html-sanitizer/20191001.1/owasp-java-html-sanitizer-20191001.1.jar:/Users/keshavmac/.m2/repository/commons-configuration/commons-configuration/1.10/commons-configuration-1.10.jar:/Users/keshavmac/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar:/Users/keshavmac/.m2/repository/io/cucumber/cucumber-testng/6.1.2/cucumber-testng-6.1.2.jar:/Users/keshavmac/.m2/repository/org/seleniumhq/selenium/selenium-java/3.141.59/selenium-java-3.141.59.jar:/Users/keshavmac/.m2/repository/org/seleniumhq/selenium/selenium-api/3.141.59/selenium-api-3.141.59.jar:/Users/keshavmac/.m2/repository/org/seleniumhq/selenium/selenium-chrome-driver/3.141.59/selenium-chrome-driver-3.141.59.jar:/Users/keshavmac/.m2/repository/org/seleniumhq/selenium/selenium-edge-driver/3.141.59/selenium-edge-driver-3.141.59.jar:/Users/keshavmac/.m2/repository/org/seleniumhq/selenium/selenium-firefox-driver/3.141.59/selenium-firefox-driver-3.141.59.jar:/Users/keshavmac/.m2/repository/org/seleniumhq/selenium/selenium-ie-driver/3.141.59/selenium-ie-driver-3.141.59.jar:/Users/keshavmac/.m2/repository/org/seleniumhq/selenium/selenium-opera-driver/3.141.59/selenium-opera-driver-3.141.59.jar:/Users/keshavmac/.m2/repository/org/seleniumhq/selenium/selenium-remote-driver/3.141.59/selenium-remote-driver-3.141.59.jar:/Users/keshavmac/.m2/repository/org/seleniumhq/selenium/selenium-safari-driver/3.141.59/selenium-safari-driver-3.141.59.jar:/Users/keshavmac/.m2/repository/org/seleniumhq/selenium/selenium-support/3.141.59/selenium-support-3.141.59.jar:/Users/keshavmac/.m2/repository/net/bytebuddy/byte-buddy/1.8.15/byte-buddy-1.8.15.jar:/Users/keshavmac/.m2/repository/org/apache/commons/commons-exec/1.3/commons-exec-1.3.jar:/Users/keshavmac/.m2/repository/com/google/guava/guava/25.0-jre/guava-25.0-jre.jar:/Users/keshavmac/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar:/Users/keshavmac/.m2/repository/org/checkerframework/checker-compat-qual/2.0.0/checker-compat-qual-2.0.0.jar:/Users/keshavmac/.m2/repository/com/google/errorprone/error_prone_annotations/2.1.3/error_prone_annotations-2.1.3.jar:/Users/keshavmac/.m2/repository/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar:/Users/keshavmac/.m2/repository/org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar:/Users/keshavmac/.m2/repository/com/squareup/okhttp3/okhttp/3.11.0/okhttp-3.11.0.jar:/Users/keshavmac/.m2/repository/com/squareup/okio/okio/1.14.0/okio-1.14.0.jar:/Applications/IntelliJ IDEA CE.app/Contents/plugins/junit/lib/junit-rt.jar:/Users/keshavmac/Library/Application Support/JetBrains/IdeaIC2020.2/plugins/cucumber-java/lib/cucumber-jvmFormatter.jar:/Users/keshavmac/Library/Application Support/JetBrains/IdeaIC2020.2/plugins/cucumber-java/lib/cucumber-jvmFormatter5.jar:/Users/keshavmac/Library/Application Support/JetBrains/IdeaIC2020.2/plugins/cucumber-java/lib/cucumber-jvmFormatter4.jar:/Users/keshavmac/Library/Application Support/JetBrains/IdeaIC2020.2/plugins/cucumber-java/lib/cucumber-jvmFormatter3.jar io.cucumber.core.cli.Main --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm5SMFormatter --name ^To test search functionality with blank submit$ --glue com.framework.utils --glue com.framework.stepDef /Users/keshavmac/IdeaProjects/com.CucumberHybrid/src/test/java/com/framework/features/Home.feature
    Invoking new Webdriver instance
    [INFO ] 2020-08-07 16:09:32.230 [main] BaseSetup - New Webdriver instance invoked
    SLF4J: Failed to load class &quot;org.slf4j.impl.StaticLoggerBinder&quot;.
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    Starting ChromeDriver 84.0.4147.30 (48b3e868b4cc0aa7e8149519690b6f6949e110a8-refs/branch-heads/4147@{#310}) on port 27490
    Only local connections are allowed.
    Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
    ChromeDriver was started successfully.
    Aug 07, 2020 4:09:33 PM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Detected dialect: W3C
    The page title verified is My Store
    The validation for mainbanner on homepage has been completed
    The validation for search field on homepage has been completed
    Closing existing Webdriver instance
    [INFO ] 2020-08-07 16:09:41.853 [main] BaseSetup - Webdriver instance closed
    
    1 Scenarios (1 passed)
    5 Steps (5 passed)
    0m10.408s
    
    
    
    Process finished with exit code 0

Here is my Baseclass file where I am using the log manager and calling the logs:-

    package com.framework.utils;
    
    import io.cucumber.java.After;
    import io.cucumber.java.Before;
    import io.github.bonigarcia.wdm.WebDriverManager;
    import org.apache.logging.log4j.LogManager;
    import org.apache.logging.log4j.Logger;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.chrome.ChromeDriver;
    import org.openqa.selenium.chrome.ChromeOptions;
    import org.openqa.selenium.safari.SafariDriver;
    import java.util.concurrent.TimeUnit;
    
    public class BaseSetup {
    
        protected static WebDriver driver=null;
        protected static PropertiesReader read;
        protected static Logger logger;
    
        @Before
        public void pre_setup(){
            read=new PropertiesReader();
            logger= LogManager.getLogger(BaseSetup.class.getName());
        }
    
        public static WebDriver webdriverSetup(){
    
            if (driver==null){
                System.out.println(&quot;Invoking new Webdriver instance&quot;);
                logger.info(&quot;New Webdriver instance invoked&quot;);
                if(read.getBrowsername().equalsIgnoreCase(&quot;chrome&quot;)){
                    WebDriverManager.chromedriver().setup();
                    ChromeOptions options=new ChromeOptions();
                    options.addArguments(&quot;--disable-notifications&quot;);
                    driver=new ChromeDriver(options);
                }
    
                else if (read.getBrowsername().equalsIgnoreCase(&quot;safari&quot;)) {
                    driver=new SafariDriver();
                }
            }
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
            return driver;
        }
    
        @After
        public void teardown(){
            if (driver!=null){
                System.out.println(&quot;Closing existing Webdriver instance&quot;);
                logger.info(&quot;Webdriver instance closed&quot;);
                driver.close();
                driver.quit();
                driver=null;
            }
        }
    }

Here is the error which I am facing in Intellij in log file for the log format:-

[![enter image description here][1]][1]


  [1]: https://i.stack.imgur.com/ooeOv.png

</details>


# 答案1
**得分**: 0

根据@hce的建议,我在Ideolog的日志格式配置设置中进行了更改,并配置了一个新的模式,即`%d{yyyy-MM-dd HH:mm:ss,SSS}`,在启用它后,Intellij抛出的错误消失了。因此,在Ideolog的日志格式中添加了这个模式后,错误问题得到解决。

<details>
<summary>英文:</summary>

As per advice of @hce I went of in configuration settings for Log format of ideolog and configured a new pattern which is `%d{yyyy-MM-dd HH:mm:ss,SSS} and immediately after enabling it, The error thrown by Intellij was gone.
Hence error was solved after adding this pattern in log format of Ideolog.

</details>



huangapple
  • 本文由 发表于 2020年8月7日 19:11:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/63300617.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定