You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Piotr P. Karwasz (Jira)" <ji...@apache.org> on 2022/02/16 15:07:00 UTC

[jira] [Commented] (LOG4J2-3405) LookupSupport Spring Boot without Cloud BusBridge

    [ https://issues.apache.org/jira/browse/LOG4J2-3405?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17493277#comment-17493277 ] 

Piotr P. Karwasz commented on LOG4J2-3405:
------------------------------------------

The Spring lookup is actually already split into the [log4j-spring](https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-spring-boot/2.17.1) artifact. This artifact does not requires Spring Cloud, just Spring Boot.

> LookupSupport Spring Boot without Cloud BusBridge
> -------------------------------------------------
>
>                 Key: LOG4J2-3405
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3405
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: Boot
>    Affects Versions: 2.17.1
>            Reporter: member sound
>            Priority: Major
>
> It would be great if Support Spring Boot [https://logging.apache.org/log4j/2.x/manual/lookups.html|https://logging.apache.org/log4j/2.x/manual/lookups.html)] like
> ${spring:spring.application.name}
> could be supported without requiring a cloud bus spring configuration. Thus being usable in normal projects.
>  
> What happens in non-cloud projects, if you include the `log4j-spring-cloud-config-client` dependency, is the following error:
> {{{{}}{}}}{{{}***************************{}}}
> {{APPLICATION FAILED TO START}}
> {{{}***************************{}}}{{{}Description:{}}}{{{}Parameter 1 of method busRemoteApplicationEventListener in org.springframework.cloud.bus.BusAutoConfiguration required a bean of type 'org.springframework.cloud.bus.BusBridge' that could not be found.{}}}
> {{}}
> It would be great having the ability to inject `application.properties` parameters from Spring in general.
>  
> I tried excluding the cloud dependency as follows:
> <{color:#000080}dependency{color}>
>    <{color:#000080}groupId{color}>org.apache.logging.log4j</{color:#000080}groupId{color}>
>    <{color:#000080}artifactId{color}>log4j-spring-cloud-config-client</{color:#000080}artifactId{color}>
>    <{color:#000080}version{color}>2.17.1</{color:#000080}version{color}>
>   <{color:#000080}exclusions{color}>
>   <{color:#000080}exclusion{color}>
>    <{color:#000080}groupId{color}>org.springframework.cloud</{color:#000080}groupId{color}>
>    <{color:#000080}artifactId{color}>spring-cloud-bus</{color:#000080}artifactId{color}>
>   </{color:#000080}exclusion{color}>
>  </{color:#000080}exclusions{color}>
> </{color:#000080}dependency{color}>
>  
> {color:#000080}spring.cloud.config.enabled{color}={color:#000080}false{color}
> {color:#000080}spring.cloud.compatibility-verifier.enabled{color}={color:#000080}false{color}
> {color:#000080}spring.application.name{color}={color:#008000}foo{color}
>  
> <{color:#000080}RollingRandomAccessFile {color}{color:#0000ff}name{color}{color:#008000}="APP" {color}{color:#0000ff}fileName{color}{color:#008000}="${path}/${spring:spring.application.name}.logs"{color}{color:#008000} {color}{color:#0000ff}filePattern{color}{color:#008000}="${path}/archive/${spring:spring.application.name}.log.gz"{color}>
>  
> This works to some degree. BUT log4j creates 2 files in this process:
> a) ${spring:spring.application.name}.logs
> b) foo.logs
>  
> Somehow the property is resolved a bit too late at some stage.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)