Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"stacktrace" and "lookup" fields for DefaultRecord don't work #96

Closed
iamed2 opened this issue Aug 5, 2018 · 2 comments
Closed

"stacktrace" and "lookup" fields for DefaultRecord don't work #96

iamed2 opened this issue Aug 5, 2018 · 2 comments

Comments

@iamed2
Copy link
Member

iamed2 commented Aug 5, 2018

I'm not sure they ever did.

julia [mementotalk]> Memento.config!("info"; fmt="{stacktrace}")
Logger(root)

julia [mementotalk]> info(getlogger("root"), "ding")
 stack:[_collect@array.jl:483, format@formatters.jl:55]

julia [mementotalk]> function foo(x)
                         info(getlogger("root"), x)
                     end
foo (generic function with 1 method)

julia [mementotalk]> foo("bar")
 stack:[_collect@array.jl:483, format@formatters.jl:55]
@rofinn
Copy link
Member

rofinn commented Aug 7, 2018

Looks like this may have been broken when I introduced the lazy record evaluation and Attribute code. I haven't checked, but we may have stopped explicitly testing the stacktrace output because that interface changed significantly between 0.5 and 0.6.

NOTE: If I evaluate the Attributes ahead of time by putting println(Dict(rec)) before the format call in the emit(::DefaultHandler, ...) call I get different stacktrace output.

julia> using Memento
INFO: Recompiling stale cache file /Users/rory/.julia/lib/v0.6/Memento.ji for module Memento.

julia> Memento.config("info"; fmt="{stacktrace}")
Logger(root)

julia> info(getlogger("root"), "ding")
Dict{Symbol,Any}(Pair{Symbol,Any}(:level, "info"),Pair{Symbol,Any}(:msg, "ding"),Pair{Symbol,Any}(:name, "root"),Pair{Symbol,Any}(:levelnum, 20),Pair{Symbol,Any}(:lookup, collect_to!(::Array{Pair{Symbol,_} where _,1}, ::Base.Generator{Array{Symbol,1},Memento.##6#7{Memento.DefaultRecord}}, ::Int64, ::Int64) at array.jl:508),Pair{Symbol,Any}(:stacktrace, StackFrame[collect_to!(::Array{Pair{Symbol,_} where _,1}, ::Base.Generator{Array{Symbol,1},Memento.##6#7{Memento.DefaultRecord}}, ::Int64, ::Int64) at array.jl:508, collect_to!(::Array{Pair{Symbol,DateTime},1}, ::Base.Generator{Array{Symbol,1},Memento.##6#7{Memento.DefaultRecord}}, ::Int64, ::Int64) at array.jl:518, _collect(::Array{Symbol,1}, ::Base.Generator{Array{Symbol,1},Memento.##6#7{Memento.DefaultRecord}}, ::Base.EltypeUnknown, ::Base.HasShape) at array.jl:489, Type at records.jl:66 [inlined]]),Pair{Symbol,Any}(:date, 2018-08-06T20:47:03),Pair{Symbol,Any}(:pid, 1))
 stack:[collect_to!@array.jl:508, collect_to!@array.jl:518, _collect@array.jl:489, Type@records.jl:66]

I'll look into this more tomorrow.

@rofinn
Copy link
Member

rofinn commented Aug 9, 2018

Upon further inspection, it looks like stacktrace doesn't work properly with the task based approach we're using to write to multiple handlers concurrently. For now, I'm going to disable async writing to handlers. I believe a better approach going forward will be for handlers to opt into asynchronously emit records. We'll still need to be careful in the emit methods that @async is being called after we've formatted the record.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants