Petersoj / alpaca-java

A Java API for Alpaca, the commission free, algo friendly, stock trading broker. https://alpaca.markets
https://petersoj.github.io/alpaca-java/
MIT License
197 stars 82 forks source link

alpaca-java's log4j2.properties file is rendering my local config unusable #74

Closed jessethouin closed 3 years ago

jessethouin commented 3 years ago

I know how to work around it, but I should not have to when using a 3rd party library. Please remove log configs from your library.

jessethouin commented 3 years ago

I should specify this is from the maven import. I should also specify that I'm very thankful for for this library!! Keep up the great work. :)

Petersoj commented 3 years ago

Thanks for reporting this. A lot of 3rd party libraries use Log4j properties and it's usually the responsibility of the library user to set their logging configuration to their liking. Use this guide to specify the Log4j properties file for your environment. I'll look in to changing how this library sets the configuration for Log4j so that it's easier for the library user.

Petersoj commented 3 years ago

Closing this as there is a solution available. Let me know if you have problems :)

Petersoj commented 3 years ago

Following up on this: I have found that using Log4j dependency with the compile closure in Gradle will cause Log4j to be included on the classpath for library users unless the library user explicitly excludes the Log4j group and artifact ID. I will be changing all the dependencies from compile to implementation which shields library users from direct access to compile dependencies that this library uses from their application. So I think it only puts the dependency on classpath at the user-level and not at the library-level. I'll be changing the logging library from Log4j (which is an SLF4j implementation) to SLF4j anyway so you won't even see a log4j.properties file on the classpath from the Maven Central artifact. Hopefully that clears things up!