<< Back to previous view

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

Status: Resolved
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/Jul/11  Resolved: 07/Jul/11

Status: Resolved
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: 06/Jul/11  Resolved: 06/Jul/11

Status: Resolved
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: 01/Jun/11  Resolved: 01/Jun/11

Status: Resolved
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-7] Reflection warnings Created: 16/Apr/12  Updated: 24/Apr/13  Resolved: 05/May/12

Status: Resolved
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-5] Improvement of sample code in README.md Created: 14/Oct/11  Updated: 17/Oct/11  Resolved: 17/Oct/11

Status: Resolved
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-6] tools.logging does not log to stdout when run from swank-clojure Created: 07/Feb/12  Updated: 07/Feb/12  Resolved: 07/Feb/12

Status: Resolved
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.





Generated at Thu Apr 24 21:41:27 CDT 2014 using JIRA 4.4#649-r158309.