<< Back to previous view

[TLOG-13] tools.logging ns form :require and :use subforms unrecognized by tools.namespace Created: 23/Aug/14  Updated: 20/Sep/14  Resolved: 20/Sep/14

Status: Closed
Project: tools.logging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Trivial
Reporter: Andy Fingerhut Assignee: Alexander Taggart
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File tlog-13-1.patch    

 Description   

Cross-reference: TNS-21

I am not sure whether this is something that should be changed in tools.logging or tools.namespace. To be sure, at most one of them should change, if either. Stuart Sierra has mentioned in TNS-21 that the ns doc string shows :require :use etc. subforms always in parentheses, and not vectors. It might be best to change tools.logging's ns form.

tools.namespace expects (:require ...) and (:use ...) subforms of the ns form to be in lists, not vectors, otherwise it ignores them.

tools.logging has ns forms that use vectors like [:require ...] and [:use ...], and are thus ignored by tools.namespace.

The Clojure compiler seems to handle these dependencies just fine, but this may be just another case where it accepts more things than it is documented to accept.



 Comments   
Comment by Andy Fingerhut [ 29/Aug/14 7:42 PM ]

Patch tlog-13-1.patch dated Aug 29 2014 simply replaces [] with () around subforms of ns forms.

Comment by Alexander Taggart [ 20/Sep/14 1:35 PM ]

https://github.com/clojure/tools.logging/commit/67d2fa8411e1f226bf1e77f3e5f6326a00e5b954





[TLOG-7] Reflection warnings Created: 16/Apr/12  Updated: 07/Jun/14  Resolved: 05/May/12

Status: Closed
Project: tools.logging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Sean Corfield Assignee: Alexander Taggart
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File 0001-Fix-TLOG-7-Remove-reflection-warnings.patch     Text File TLOG-7.1.patch    

 Description   

Reflection warning, clojure/tools/logging.clj:270 - reference to field isTraceEnabled can't be resolved.
Reflection warning, clojure/tools/logging.clj:270 - reference to field isDebugEnabled can't be resolved.
Reflection warning, clojure/tools/logging.clj:270 - reference to field isInfoEnabled can't be resolved.
Reflection warning, clojure/tools/logging.clj:270 - reference to field isWarnEnabled can't be resolved.
Reflection warning, clojure/tools/logging.clj:270 - reference to field isErrorEnabled can't be resolved.
Reflection warning, clojure/tools/logging.clj:270 - reference to field isFatalEnabled can't be resolved.
Reflection warning, clojure/tools/logging.clj:270 - call to trace can't be resolved.
Reflection warning, clojure/tools/logging.clj:270 - call to debug can't be resolved.
Reflection warning, clojure/tools/logging.clj:270 - call to info can't be resolved.
Reflection warning, clojure/tools/logging.clj:270 - call to warn can't be resolved.
Reflection warning, clojure/tools/logging.clj:270 - call to error can't be resolved.
Reflection warning, clojure/tools/logging.clj:270 - call to fatal can't be resolved.



 Comments   
Comment by Alexander Taggart [ 05/May/12 3:26 PM ]

Adds type-hints to all implementation-wrapping fns.

Comment by Trevor Bernard [ 23/Apr/13 4:39 PM ]

A few of my projects are still reflecting using tools.logging 0.2.6 and slf4j-log4j12 "1.7.2". I've attached a patch that I've started using to fix this issue.

Comment by Trevor Bernard [ 23/Apr/13 4:41 PM ]

I'm a registered contributor to clojure.

http://clojure.org/contributing

Comment by Andy Fingerhut [ 24/Apr/13 12:33 PM ]

Trevor, since this ticket was already closed and marked as completed some time ago, it is probably best to create a new ticket and attach your patch to that. I know the issue is similar to this existing ticket, but best to have new tickets for new work.





[TLOG-12] Reflection Warnings when using tools.logging Created: 30/Apr/13  Updated: 07/Jun/14  Resolved: 13/May/14

Status: Closed
Project: tools.logging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Trevor Bernard Assignee: Alexander Taggart
Resolution: Not Reproducible Votes: 0
Labels: None

Attachments: Text File 0001-Fix-TLOG-7-Remove-reflection-warnings.patch    
Waiting On: Trevor Bernard

 Description   

A few of my projects are still reflecting using tools.logging 0.2.6 and slf4j-log4j12 "1.7.2".

lein check produces the following output:

...
Reflection warning, curator_clj/zookeeper.clj:1:1 - reference to field isTraceEnabled can't be resolved.
Reflection warning, curator_clj/zookeeper.clj:1:1 - reference to field isDebugEnabled can't be resolved.
Reflection warning, curator_clj/zookeeper.clj:1:1 - reference to field isInfoEnabled can't be resolved.
Reflection warning, curator_clj/zookeeper.clj:1:1 - reference to field isWarnEnabled can't be resolved.
Reflection warning, curator_clj/zookeeper.clj:1:1 - reference to field isErrorEnabled can't be resolved.
Reflection warning, curator_clj/zookeeper.clj:1:1 - reference to field isErrorEnabled can't be resolved.
...



 Comments   
Comment by Alexander Taggart [ 30/Apr/13 5:37 PM ]

I've made a quick test project: https://github.com/ataggart/reflect-log-test

Cloning that repo, running lein check yields no reflection warnings.

Please provide a way for me to reproduce what you see.

Comment by Trevor Bernard [ 30/Apr/13 5:46 PM ]

Forking that project and will try to find a simple test case that reproduces it.





[TLOG-6] tools.logging does not log to stdout when run from swank-clojure Created: 07/Feb/12  Updated: 07/Jun/14  Resolved: 07/Feb/12

Status: Closed
Project: tools.logging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Trevor Bernard Assignee: Alexander Taggart
Resolution: Declined Votes: 0
Labels: None
Environment:

tools.logging "0.2.3", Mac OS X Lion, emacs 23.4, swank-clojure 1.3.4, slime 20100404



 Description   

Trying to evaluate (info "Hello, World!") doesn't print to stdout when evaluating from within emacs. It works if I `lein run` however.



 Comments   
Comment by Trevor Bernard [ 07/Feb/12 8:44 PM ]

It works when I use the inferior-lisp process but not in slime

Comment by Alexander Taggart [ 07/Feb/12 9:07 PM ]

Configuring swank/slime to work with wherever your log implementation writes its output is not a tools.logging issue.





[TLOG-5] Improvement of sample code in README.md Created: 14/Oct/11  Updated: 07/Jun/14  Resolved: 17/Oct/11

Status: Closed
Project: tools.logging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Jingguo Yao Assignee: Alexander Taggart
Resolution: Completed Votes: 0
Labels: None


 Description   

README.md uses the following code to show the usage of tools.logging.

(ns example.core
  (:use [clojure.tools.logging :only (info error)]))

(defn divide [one two]
  (try
    (info "Calculated" (/ one two))
    (catch Exception ex
      (error ex "There was an error in calculation"))))

If log4j.rootLogger in the given log4j.properties is updated to "ERROR, A1". "(divide 10 0)" won't evaluate "(error ex "There was an error in calculation")". The reason is that INFO logging level is lower than ERROR logging level. So the info macro will not evaluate "(/ one two)" since the specific INFO logging level is not in effect.

New tools.logging users often expect "(divide 10 0)" to produce logging with ERROR level. They are confused with the above behaviour. So I suggest to make some change to the sample code. Maybe the following code:

(ns example.core
  (:use [clojure.tools.logging :only (info error)]))

(defn divide [one two]
  (try 
    (info "Calculating" one two)
    (/ one two)
    (catch Exception ex
      (error ex "There was an error in calculation"))))





[TLOG-4] Provided implementations of logging protocols fail. Created: 29/Sep/11  Updated: 07/Jun/14  Resolved: 29/Sep/11

Status: Closed
Project: tools.logging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Blocker
Reporter: Alexander Taggart Assignee: Alexander Taggart
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File fix-broken-extend.patch    
Patch: Code and Test

 Description   

Example of error when trying to call a Logger protocol function:

java.lang.IllegalArgumentException: No implementation of method: :enabled? of protocol:
#'clojure.tools.logging.impl/Logger found for class: org.apache.log4j.Logger

The bug is the result of combining syntax-quoting with extend-type, e.g.:

`(do
   (extend-type org.apache.commons.logging.Log
     Logger
     (enabled? [logger# level#] ... )))

The syntax-quote turns the above enabled? into clojure.tools.logging/enabled? protocol function name, and then the extend-type turns that into the keyword :clojure.tools.logging/enabled?, which does not match the expected :enabled?.

Attached patch fixes this by using extend maps rather than extend-type. Also adds some tests.



 Comments   
Comment by Alexander Taggart [ 29/Sep/11 3:36 PM ]

Committed:

https://github.com/clojure/tools.logging/commit/f9cb0a7232d3a11cb7e74e4c13c3adc054e7e7a2





[TLOG-3] Move implementation-specific details out of main ns Created: 06/Jul/11  Updated: 07/Jun/14  Resolved: 07/Jul/11

Status: Closed
Project: tools.logging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: Alexander Taggart Assignee: Alexander Taggart
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File refactor-namespaces.patch    
Patch: Code and Test
Approval: Ok

 Description   

The protocols which allow the main functions/macros to adapt to implementation specific logging libraries do not need to be in the clojure.tools.logging namespace since they are not intended to be used by consumers.

Plan:

  • Move protocols into clojure.tools.logging.impl
  • Move implementation-specific code (e.g., the extentions to the protocols) into separate namespaces, e.g., clojure.tools.logging.log4j.


 Comments   
Comment by Alexander Taggart [ 07/Jul/11 6:49 PM ]

https://github.com/clojure/tools.logging/commit/42dfba84a373e52a4e80af6467e47761e6f20678





[TLOG-2] Change "log" semantics to "logger" semantics Created: 05/Jul/11  Updated: 07/Jun/14  Resolved: 06/Jul/11

Status: Closed
Project: tools.logging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Laurent Petit Assignee: Laurent Petit
Resolution: Completed Votes: 0
Labels: None

Attachments: File tools.logging-TLOG-2-v2.diff    
Patch: Code and Test
Approval: Ok

 Description   

The relevant patch is named tools.logging-TLOG-2-v2.diff

Changes "log" semantics to "logger" semantics.

Log protocol becomes LoggerProtocol
LogFactory protocol becomes LoggerFactoryProtocol
log-factory becomes logger-factory
impl-get-log becomes impl-get-logger
log function argument name becomes logger function argument name
log# macro autosym becomes logger# macro autosym



 Comments   
Comment by Alexander Taggart [ 06/Jul/11 3:00 PM ]

Committed to master:
https://github.com/clojure/tools.logging/commit/0a5f9bd3148cf078dd0b62aece5f92a970b5aba3





[TLOG-1] Non-optimized, no-exception path for logp calls log* with wrong arity Created: 01/Jun/11  Updated: 07/Jun/14  Resolved: 01/Jun/11

Status: Closed
Project: tools.logging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Alexander Taggart Assignee: Alexander Taggart
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File TLOG-1.patch    
Patch: Code and Test

 Description   

Per Laurent Petit



 Comments   
Comment by Alexander Taggart [ 01/Jun/11 11:34 AM ]

https://github.com/clojure/tools.logging/commit/687c1833c59ad1204c2a41cf0ed1f53be4a0fa8d





[TLOG-9] spy macro (or new spy macro) that accepts a message Created: 08/Dec/12  Updated: 07/Jun/14  Resolved: 07/Jun/14

Status: Closed
Project: tools.logging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Dave Sann Assignee: Alexander Taggart
Resolution: Completed Votes: 0
Labels: None


 Description   

I think it might be useful to have spy be able to take a message to be logged in addition to the data. (or have a similar macro showing an optional message instead of the code).

(spy "doing x" (blah))
(spy :doing-x (blah) ; because it is easier to type sometimes

with spy this may conflict with the log-level.

I find this sort of function with a message useful and use it quite often. Much more often than plain logging. Generally - I would't log the code unless it logged file and line number too.



 Comments   
Comment by Alexander Taggart [ 07/Jun/14 7:10 PM ]

Added spyf, which takes a format string.

https://github.com/clojure/tools.logging/commit/91bc737ac37e1dbf8f4d658aa304154afac7a1dc





[TLOG-11] tools.logging doesn't AOT Created: 22/Mar/13  Updated: 30/Apr/13  Resolved: 30/Apr/13

Status: Closed
Project: tools.logging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Allen Rohner Assignee: Alexander Taggart
Resolution: Declined Votes: 0
Labels: None

Waiting On: Allen Rohner

 Description   

tools.logging does not work if used in a project that is AOT'd.

To reproduce, in a project using tools.logging:

lein jar
lein run

I can workaround it in my project by including

(when *compile-files*
  (compile 'clojure.tools.logging)
  (compile 'clojure.tools.logging.impl))


 Comments   
Comment by Alexander Taggart [ 30/Apr/13 5:11 PM ]

It's not clear to me what "does not work" means.

I've made a quick test project: https://github.com/ataggart/aot-log-test

Cloning that repo, running lein jar then lein run yields the output I would expect.

Further details appreciated.

Comment by Allen Rohner [ 30/Apr/13 6:32 PM ]

This isn't a bug; User Error.

I thought I had fully isolated the bug in my app's codebase, but I forgot about an :injection that we have that jams a debug macro into clojure.core.

for posterity, it was caused by doing

(binding [*ns* (find-ns 'clojure.core)]
  (require 'clojure.tools.logging)
  (defmacro inspect
    "prints the expression '<name> is <value>', and returns the value"
    [value]
    `(do
       (let [value# (quote ~value)
             result# ~value]
         (println value# "is" (with-out-str (clojure.pprint/pprint result#)))
         (clojure.tools.logging/infof "%s is %s" value# result#)
         result#))

Moving the require call to inside the macroexpansion resolved the bug. (And yes, I'm moving to https://github.com/dgrnbrg/spyscope now that I'm aware of it)

Sorry to waste your time, Alex.

Comment by Alexander Taggart [ 30/Apr/13 7:06 PM ]

No worries.

On a related note, do you see any utility in keeping the spy macro? It's pretty much what you're doing. Do you use inspect for logging or as an in-repl debugging tool? Perhaps spy makes more sense in tools.trace.

Comment by Allen Rohner [ 30/Apr/13 7:12 PM ]

TBH, I didn't know about spy. Also, my inspect macro predates clojure.tools.logging, and might even predate clojure.contrib.logging, if you can believe that.

I use inspect as a debugging tool. The main value to jamming it into clojure.core is that I can use it in any file, without having to stop and muck with the ns declaration. Therefore if I was going to use anything else, it would need to have that property.





[TLOG-10] Double-evaluation of arguments Created: 04/Feb/13  Updated: 04/Feb/13  Resolved: 04/Feb/13

Status: Closed
Project: tools.logging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Chris Perkins Assignee: Alexander Taggart
Resolution: Completed Votes: 0
Labels: None
Environment:

tools.logging 0.2.5-SNAPSHOT


Attachments: File double-eval.diff    

 Description   

The expansion of the log macros can double-evaluate the first argument.

For example, the following call:

(log/info (expensive-call foo) bar)

Expands to this:

(let*
[logger_278auto_
(get-logger logger-factory #<Namespace scratch.core>)]
(if (enabled? logger_278auto_ :info)
(if (instance? java.lang.Throwable (expensive-call foo))
(log*
logger_278auto_
:info
(expensive-call foo)
(print-str bar))
(log*
logger_278auto_
:info
nil
(print-str (expensive-call foo) bar)))))

Note the calls to "expensive-call" both in the instance check and in the log* call.



 Comments   
Comment by Alexander Taggart [ 04/Feb/13 10:28 PM ]

Fixed in 0.2.6.





[TLOG-8] README.md still refers to using version 0.2.3 of tools.logging Created: 24/Nov/12  Updated: 04/Feb/13  Resolved: 04/Feb/13

Status: Closed
Project: tools.logging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Trivial
Reporter: Trevor Bernard Assignee: Alexander Taggart
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File TLOG-8.patch    

 Description   

The latest version is 0.2.4 and should reflected in the README



 Comments   
Comment by Alexander Taggart [ 04/Feb/13 10:27 PM ]

Fixed in 0.2.6.





Generated at Tue Sep 30 05:27:23 CDT 2014 using JIRA 4.4#649-r158309.