Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-08

Redirecting heap trace output to stdout

10 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

leledumbo

The only available function for dumping heap trace output is DumpHeap, which outputs to stderr. However, it's problematic to use it in a web environment, because web servers tend to give "internal server error" whenever stderr is not empty. Therefore, I'd like to redirect it to stderr, but I have no idea how...

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Redirecting-heap-trace-output-to-stdout-tp4708982p4708982.html Sent from the Free Pascal - General mailing list .
Bart
to leledumbo

If it's on Linux, you can redirect stderr to stdout on the commandline...

Don'tknow the exact syntax though.

Bart

leledumbo wrote 14 lines
The only available function for dumping heap trace output is DumpHeap, which outputs to stderr. However, it's problematic to use it in a web environment, because web servers tend to give "internal server error" whenever stderr is not empty. Therefore, I'd like to redirect it to stderr, but I have no idea how... -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Redirecting-heap-trace-output-to-stdout-tp4708982p4708982.html Sent from the Free Pascal - General mailing list . _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Graeme Geldenhuys
to Jonas Maebe
Jonas Maebe wrote
assign(stderr,'somefile'); rewrite(stderr);

I think you might be able to use the heaptrc environment variable for that as well. Not 100% sure if it will work in the case of a web app, but I can't see why not.

See the heaptrc unit documentation for the name of the environment variable - I can't remember it off the top of my head.

Regards,   - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net
Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 8 lines
On 17 August 2011 19:13, Jonas Maebe wrote: > > assign(stderr,'somefile'); > rewrite(stderr); I think you might be able to use the heaptrc environment variable for that as well. Not 100% sure if it will work in the case of a web app, but I can't see why not.

When using CGI, you don't control the environment. The webserver does.

Michael.

Graeme Geldenhuys
to Michael Van Canneyt
Michael Van Canneyt wrote
When using CGI, you don't control the environment. The webserver does.

If you are in control of the webserver (like when you are developing apps), can't you add new environment variables to Apache's configs files etc.. I vaguely remember reading something like that.

Obviously this will not work (or is not recommended) on "life" web servers. But Jonas' idea is probably easier.

Regards,   - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net
Martin
to leledumbo
leledumbo wrote
> assign(stderr,'somefile'); > rewrite(stderr); Thanks, nicely done.

Why is the file in ide only?

If it was in a package, then the users could add it to their project too. (if they want)

Martin
to Martin
Martin wrote 10 lines
On 17/08/2011 23:29, leledumbo wrote: >> assign(stderr,'somefile'); >> rewrite(stderr); > Thanks, nicely done. > Why is the file in ide only? If it was in a package, then the users could add it to their project too. (if they want)

sorry replied to wrong mail (partly the right thread though)