Re: kernel loglevel

2016-10-17 Thread Wenda Ni
Hi Joel,

It works by specifying ccflags-y += -DDEBUG in the Makefile.

Thank you for the info


Cheers,

Wenda Ni, Ph.D.


On Mon, Oct 17, 2016 at 7:48 PM, Joel Fernandes 
wrote:

> Hi Wenda,
>
> pr_debug needs you to define the DEBUG macro to activate it.
>
> Check:
> http://stackoverflow.com/questions/28936199/pr-debug-not-giving-any-output
>
> and the kernel docs,
> https://www.kernel.org/doc/local/pr_debug.txt
>
> Joel
>
> On Mon, Oct 17, 2016 at 4:17 PM, Wenda Ni  wrote:
> > Dear all,
> >
> > I am working on a kernel module that incorporate both pr_debug and
> > pr_warn. I would like to see pr_debug messages from dmesg.
> >
> > What I followed is to specify kernel parameter by saying "loglevel=7".
> > This can be seen confirmed  from /proc/cmdline. But still, I donot get
> > pr_debug level messages either from dmesg or from /var/log/messages. I
> > also tried echo 7 > /proc/sys/kernel/printk. It does not return what I
> > expect, either.
> >
> > Let me know what I am missing. Thank you very much in advance.
> >
> > Cheers,
> >
> > Wenda Ni, Ph.D.
> >
> > ___
> > Kernelnewbies mailing list
> > Kernelnewbies@kernelnewbies.org
> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: kernel loglevel

2016-10-17 Thread Thibaut SAUTEREAU
On Mon, Oct 17, 2016 at 07:17:32PM -0400, Wenda Ni wrote:
> Dear all,
> 
> I am working on a kernel module that incorporate both pr_debug and
> pr_warn. I would like to see pr_debug messages from dmesg.
> 
> What I followed is to specify kernel parameter by saying "loglevel=7".
> This can be seen confirmed  from /proc/cmdline. But still, I donot get
> pr_debug level messages either from dmesg or from /var/log/messages. I
> also tried echo 7 > /proc/sys/kernel/printk. It does not return what I
> expect, either.
> 
> Let me know what I am missing. Thank you very much in advance.
> 
> Cheers,
> 
> Wenda Ni, Ph.D.
> 
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Hello Wenda,


 



 
I encountered the same issue a while ago.   


 
As stated here: http://elinux.org/Debugging_by_printing 


 
pr_debug is replaced with an empty statement unless the kernel is compiled  


 
with DEBUG. So if you just want to play with printing kernel debug logs,


 
just define the DEBUG macro in your module source file for testing. 


 



 
I also observed that without a new line character at the end of the string  


 
passed to pr_debug, I could not find the log line in dmesg output. Not sure 


 
where this comes from.

-- 
Thibaut SAUTEREAU


signature.asc
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: kernel loglevel

2016-10-17 Thread Joel Fernandes
Hi Wenda,

pr_debug needs you to define the DEBUG macro to activate it.

Check:
http://stackoverflow.com/questions/28936199/pr-debug-not-giving-any-output

and the kernel docs,
https://www.kernel.org/doc/local/pr_debug.txt

Joel

On Mon, Oct 17, 2016 at 4:17 PM, Wenda Ni  wrote:
> Dear all,
>
> I am working on a kernel module that incorporate both pr_debug and
> pr_warn. I would like to see pr_debug messages from dmesg.
>
> What I followed is to specify kernel parameter by saying "loglevel=7".
> This can be seen confirmed  from /proc/cmdline. But still, I donot get
> pr_debug level messages either from dmesg or from /var/log/messages. I
> also tried echo 7 > /proc/sys/kernel/printk. It does not return what I
> expect, either.
>
> Let me know what I am missing. Thank you very much in advance.
>
> Cheers,
>
> Wenda Ni, Ph.D.
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: kernel loglevel

2016-10-17 Thread Wenda Ni
Thank you so much, Thibaut. I have spotted the source-code logic in
include/linux/prink.h

Cheers,

Wenda Ni, Ph.D.



On Mon, Oct 17, 2016 at 7:41 PM, Thibaut SAUTEREAU <
thibaut.sauter...@telecom-sudparis.eu> wrote:
> On Mon, Oct 17, 2016 at 07:17:32PM -0400, Wenda Ni wrote:
>> Dear all,
>>
>> I am working on a kernel module that incorporate both pr_debug and
>> pr_warn. I would like to see pr_debug messages from dmesg.
>>
>> What I followed is to specify kernel parameter by saying "loglevel=7".
>> This can be seen confirmed  from /proc/cmdline. But still, I donot get
>> pr_debug level messages either from dmesg or from /var/log/messages. I
>> also tried echo 7 > /proc/sys/kernel/printk. It does not return what I
>> expect, either.
>>
>> Let me know what I am missing. Thank you very much in advance.
>>
>> Cheers,
>>
>> Wenda Ni, Ph.D.
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
> Hello Wenda,
>
> I encountered the same issue a while ago.
> As stated here: http://elinux.org/Debugging_by_printing
> pr_debug is replaced with an empty statement unless the kernel is compiled
> with DEBUG. So if you just want to play with printing kernel debug logs,
> just define the DEBUG macro in your module source file for testing.
>
> I also observed that without a new line character at the end of the string
> passed to pr_debug, I could not find the log line in dmesg output. Not
sure
> where this comes from.
>
> --
> Thibaut SAUTEREAU
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies