Hi all.
I'm new to Linux and perl developing.
Where I can put debug log messages inside otrs code?
And where can I see them?
Thanks
PLace dubug messages in code
-
- Znuny superhero
- Posts: 890
- Joined: 15 Dec 2016, 15:13
- Znuny Version: All
- Real Name: Emin
- Company: Efflux GmbH
- Contact:
Re: PLace dubug messages in code
Hello,
You can use the Data::Dumper.
Put this inside your code and replace the variables you want to dump.
Check the error log of your web server.
Don't use your production system.
— Emin
You can use the Data::Dumper.
Put this inside your code and replace the variables you want to dump.
Code: Select all
print Data::Dumper->Dump([$Scalar, \@Array, \%Hash]);
Don't use your production system.
— Emin
Professional OTRS, Znuny & OTOBO services: efflux.de | efflux.de/en/
Free and premium add-ons: German | English
Free and premium add-ons: German | English
-
- Znuny newbie
- Posts: 95
- Joined: 11 Jun 2020, 14:56
- Znuny Version: 6.5.8
- Real Name: Rodolfo Rughi
- Company: none
Re: PLace dubug messages in code
Thanks zzz!
-
- Znuny newbie
- Posts: 10
- Joined: 24 Jan 2018, 11:58
- Znuny Version: All
- Real Name: Tim
- Company: maxence business consulting GmbH
- Location: Dormagen
- Contact:
Re: PLace dubug messages in code
To extend a bit on Emins post, you can use
to also get the file and line you dump is coming from.
Code: Select all
print STDERR Data::Dumper->Dump([(caller(0))[3] . ' Line:' . __LINE__ , \ $TestValue ]);
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: PLace dubug messages in code
If you want the debug output in the same log as other OTRS logs, you should use
And when you want to use the other proposed code snippets, I would recommend to use Data::Printer as it sorts keys of hashes automatically and it has a more compact format. But you might need to install the module...
Code: Select all
$Kernel::OM->Get('Kernel::System::Log')->Log( Priority => error => Message => $Kernel::OM->Get('Kernel::System::Main')->Dump( [1,2,3] ) );
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de