Opened 6 years ago

Closed 4 years ago

#6938 closed defect (implemented)

Log early log messages to log files

Reported by: shamrock Owned by:
Priority: High Milestone: Tor: 0.2.6.x-final
Component: Core Tor/Tor Version: Tor: 0.2.4.2-alpha
Severity: Keywords: tor-client 026-triaged-1 nickm-patch
Cc: Actual Points:
Parent ID: #10059 Points:
Reviewer: Sponsor:

Description (last modified by arma)

Issue:
When configuring Tor as a bridge and to advertise a DirPort, the resulting warning is displayed on the console, but is not logged to the Tor log file.

Environment:
Debian squeeze amd64, latest patches
Tor version 0.2.4.2-alpha (git-0537dc6364594474)

How to reproduce:
Set "BridgeRelay 1"
Set "DirPort 80"

Start Tor.

The following warning will be displayed on the console:
"Starting tor daemon...<date will be here> [warn] Can't set a DirPort on a bridge relay; disabling DirPort
done."

No corresponding warning is logged to the Tor log file.

Child Tickets

Change History (14)

comment:1 Changed 6 years ago by shamrock

Typo. I meant "advertise a DirPort" not "advertise an ORPort".

comment:2 Changed 6 years ago by arma

Component: - Select a componentTor Client
Description: modified (diff)

This happens because Tor puts out that warning while parsing its config, and part of parsing the config is learning what logs the user wants to use. So, there aren't any log files open at that point.

Should we queue "logged stuff" until the log is open, then spit it all out there? That sounds like it could be confusing in the other direction.

comment:3 Changed 6 years ago by nickm

Milestone: Tor: 0.2.4.x-final
Priority: trivialnormal

comment:4 Changed 6 years ago by nickm

Keywords: tor-client added

comment:5 Changed 6 years ago by nickm

Component: Tor ClientTor

comment:6 Changed 6 years ago by nickm

Milestone: Tor: 0.2.4.x-finalTor: 0.2.5.x-final
Priority: normalmajor

comment:7 Changed 5 years ago by nickm

Milestone: Tor: 0.2.5.x-finalTor: 0.2.6.x-final

comment:8 Changed 5 years ago by andrea

Keywords: 026-triaged-1 added
Milestone: Tor: 0.2.6.x-finalTor: 0.2.7.x-final

This is going to 0.2.7; it's not that hard to fix but not trivial - we need a buffering mechanism to save log messages generated early before log files are set up.

comment:9 Changed 5 years ago by gsathya

Parent ID: #10059

comment:10 Changed 5 years ago by arma

The Tor launcher folks want this feature too -- it turns out that the trick we use for running an external binary from a Firefox extension means you can't get at stdout.

comment:11 Changed 5 years ago by nickm

Keywords: nickm-patch added
Milestone: Tor: 0.2.7.x-finalTor: 0.2.6.x-final
Status: newneeds_review

If somebody does a patch, we could take it as early as 0.2.6.

The way to do it is like this: on startup, have the log mechanism store every logged message in a structure holding the time, the severity, the log domain, and ...

oh heck, I'll just do it.

(90 minutes later)

See branch "ticket6938" in my public repository. It'll help with logfiles and syslogs, but controllers that want to see early log messages via controller events are still out of luck.

comment:12 Changed 4 years ago by asn

Code looks good to me. Didn't test it though.

It's clean and also cleans out already existing code.

comment:13 Changed 4 years ago by nickm

Summary: Bridge DirPort warning not logged to Tor log fileLog early log messages to log files

comment:14 Changed 4 years ago by nickm

Resolution: implemented
Status: needs_reviewclosed

Okay. It still works for me, so merging it. Thanks for the review!

Note: See TracTickets for help on using tickets.