Comments (7)
Hi Deraen,
I'm not experienced in Java and Clojure logging infrastructure. I just picked org.clojure/tools.logging
and clj-logging-config
seemed like a convenient way how to configure my logs via code and not have to learn some arcane ways how to configure it via java config files.
Do you have any proposals what should I ideally do?
Anyways, I think I can make dependency on clj-logging-config
optional. Even today you can provide :skip-logging-setup
in agent and nrepl configs, but the dependencies will be still referenced (I could try to resolve them dynamically only if :skip-logging-setup
is not specified)..
dirac/src/agent/dirac/agent/impl.clj
Lines 136 to 137 in aec8ee5
from dirac.
It is a good practice that libraries do not require specific logging implementations, but instead just use some API (log4j-api, slf4-api etc) and leave it to the application to select implementation. For example both slf4j and log4j 2 provide implementations for nearly all the other logging APIs. These "bridges" take care of redirecting messages to selected implementation. All the configuration (filters, appenders) is dependent on the logging implementation. This means that libraries can't define those.
Also, log4j 1 has been deprecated in favor of log4j 2: http://logging.apache.org/log4j/1.2/. Which is one reason I wouldn't use it or clj-logging-config.
As for solution,
Is there any reason Dirac needs to use Java logging at all?
Logging can be very useful if the app needs to do:
- audit logging (messages must not be lost)
- messages need to be filtered
- messages need to be sent to multiple output (logging servers, files, console, etc)
- same format needs to be used for messages from all logging sources (app code, http server, database driver), so that this can be easily analyzed by tools
I don't think Dirac needs any of these?
In Boot the logging has been implemented by some tens lines of code which just uses print
and one atom to select logging level: https://github.com/boot-clj/boot/blob/master/boot/pod/src/boot/util.clj#L21-L99. Similar implementation should work here, maybe with addition of macro which sets the color based on namespace.
from dirac.
Thanks for the detailed response.
Dirac Agent is a server-side component/app which should log somehow.
Dirac nRELP middleware is another component living in nREPL server.
Both use dirac.lib namespaces which are reusable components which want to do some logging as well.
I thought it is idiomatic in Clojure world to use org.clojure/tools.logging
(which should be agnostic to logging implementation). I just made the mistake of bringing in clj-logging-config as a hard dependency. I wanted to customize colors and format the output.
I'm about to cut a new Dirac 0.7 release today or tomorrow. So I want to fix this for you. I'm going to keep using org.clojure/tools.logging
, but will drop dependency on clj-logging-config. Will use it only if top-level app including my components explicitly asks for it.
from dirac.
Sounds good.
Using tools.logging
is indeed fine (and idiomatic).
from dirac.
@Deraen I think this is enough to get rid of the blocking dependency. Would be great if you could clone dirac repo, and do lein install
. This should install HEAD version of dirac library into your local maven repository and you could test it with your project. Don't expect it to talk to Dirac Chrome extension, but at least we would see if you can get past that dependency issue.
from dirac.
@darwin Yep, I can start repl now.
from dirac.
Cool, thanks for confirmation. Will release a new Dirac version in a few hours.
from dirac.
Related Issues (20)
- On Dev Tools, how can I switch from Console to Diract? Or, in other words, how can I execute step 5 of the Quick Start Guide?
- ns/as-alias not supported
- TypeError: this._prompt.belowEditorElement is not a function HOT 2
- Error: uiSourceCode expected to have scriptFile associated
- Sources > Filesystem > "Add Folder To Workspace" not working in Dirac 1.2.37 HOT 8
- Need *source-map-data-gen-col* binding HOT 1
- Dirac window is blank on startup in Dirac 1.2.38 HOT 2
- Internal Dirac Error TypeError: target.emulationAgent(...).setFocusEmulationEnabled is not a function HOT 1
- Custom formatters not always applied HOT 1
- Internal Dirac Error Cannot find context with specified id
- Recipe for build.boot HOT 1
- Add electron support HOT 2
- first
- windows installation HOT 1
- Run Dirac CLI in the background HOT 2
- Loopback mode and pausing on a breakpoint HOT 2
- Does dirac need a proxy ? HOT 1
- Failed to create a ProcessSingleton for your profile directory HOT 1
- Missing is<Browser> methods with recent versions of ClojureScript
- I can't run Dirac on MacOS, it keeps complaining about org.clojure/data.json - even though it is listed as a dependency HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dirac.