This forum has been archived. All content is frozen. Please use KDE Discuss instead.

OutputDebugString equivalent?

Tags: None
(comma "," separated)
mobilehunter
Registered Member
Posts
17
Karma
0
OS

OutputDebugString equivalent?

Tue Apr 21, 2009 10:59 pm
Hi,

I'm developing plasmoid now.
To see debug messages from my plasmoid, i ran my plasmoid using plasmoidviewer from konsole.
But i have problem when i put my plasmoid to panel. To debug in this circumstance, i have to 'kquitapp plasma' then run again from konsole. And i feel this is not the right way.

Below are my questions:
1. Is there any OutputDebugString equivalent in KDE or in linux?
2. Can we capture the output of kDebug from other application?
3. What is the best practice when debugging plasma, especially if it put in panel?

Thanks
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

RE: OutputDebugString equivalent?

Tue Apr 21, 2009 11:24 pm
What exactly does "OutputDebugString" do? You could use KNotification to produce a dialog with some debugging information, if it just shows a dialog with some information.

I do not believe it is possible to capture the output of stderr / stdout from another application, which is what kWarning() and kDebug() output to respectively.

You could also use QDBus in your Plasmoid to retrieve information from it, by placing your debugging messages in a QStringList, then adding a scriptable method to retrieve it, which would give the desired effect.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
pansz
Registered Member
Posts
113
Karma
0
OS

RE: OutputDebugString equivalent?

Wed Apr 22, 2009 1:49 am
mobilehunter wrote:To see debug messages from my plasmoid, i ran my plasmoid using plasmoidviewer from konsole.
But i have problem when i put my plasmoid to panel. To debug in this circumstance, i have to 'kquitapp plasma' then run again from konsole. And i feel this is not the right way.
Below are my questions:
1. Is there any OutputDebugString equivalent in KDE or in linux?
2. Can we capture the output of kDebug from other application?
3. What is the best practice when debugging plasma, especially if it put in panel?
Thanks


1. yes, syslog() function should give you something. you can use tail -f /var/log/syslog at any new konsole to see the output.

2. inside other application, you can use popen() to open your testing application, then you can capture stdout of your testing application.

3. I use syslog() exclusively and I think it is best. The only problem: syslog() exists only in Linux, Windows does not have it.

Last edited by pansz on Wed Apr 22, 2009 1:52 am, edited 1 time in total.
User avatar
grissiom
Registered Member
Posts
49
Karma
0
OS

RE: OutputDebugString equivalent?

Wed Apr 22, 2009 4:32 am
I think you may write your debug info into a file if you are sure that you won't have debug code in your release version.


grissiom, proud to be a member of KDE forums since 2008-Oct.
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS

RE: OutputDebugString equivalent?

Wed Apr 22, 2009 8:12 am
bcooksley wrote:I do not believe it is possible to capture the output of stderr / stdout from another application, which is what kWarning() and kDebug() output to respectively.


I think in the case of an application started from within the session environment, e.g. through the application start menu, at least some output ends up in $HOME/.xsession-errors

Additionally, output going through KDE's logging framework can be redirected to a file, syslog, etc.
See the kdebugrc file, usually installed at the same location as all other global KDE configs and working like any other KDE config, e.g. a local version in $KDEHOME/share/config will override the global one.

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
mobilehunter
Registered Member
Posts
17
Karma
0
OS

RE: OutputDebugString equivalent?

Wed Apr 22, 2009 10:09 pm
Thanks for sharing.

I think syslog and tail are what i need now.
Inside kdebugrc there is option to redirect the output of kDebug.
Below are excerpt from kdebugrc.
Code: Select all
# For the debug area 100 you want output of debug messages
# to a file /var/log/dbg.log and error messages as message boxes.
# Additionally the program should abort on fatal errors.
#
# [100]
# InfoOutput=0
# InfoFilename=/var/log/dbg.log
# ErrorOutput=1
# AbortFatal=1

# KGlobalAccel debug info off
[125]
InfoOutput=4

# KAction debug info off
[129]
InfoOutput=4


Since i'm using python to develop my plasma, it seem i cannot use kdebugrc yet.
Because kDebug not exist (as far as i know) at current pykde.

For anyone using c++ you can use these area code 1204 for plasma, 1209 for libplasma


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot]