Grails junk of debug logs - grails-2.2

log4j = {
appenders {
'null' name:'stacktrace'
environments {
development {
rollingFile name: "appLog",
maxFileSize:'102400kB',
file: "./logs/tempAppLog.log",
layout:pattern(conversionPattern: '%d{[EEE, dd-MMM-yyyy # HH:mm:ss.SSS]} [%t] %-5p %c %x - %m%n')
root {
debug 'appLog'
}
}
}
}
error 'grails.app.service' //Service
error 'grails.app.controller' // controllers
error 'com.demoapp'
info 'grails.app.service'
info 'grails.app.controller'
info 'com.demoapp'
debug 'grails.app.service'
debug 'grails.app.controller'
debug 'com.demoapp'
}
Here using above configuration it writes lots of debug logs inside tempAppLog.log which all having no use. I only want my package level debug logs. I am using grails 2.2.1 version.
Please help me to avoid unused logs to be written in file, only package specific logs should be written in file.
Thanks.

change the
root {
debug 'appLog'
}
to
root {
error 'appLog'
}
may be help you

Related

Configuring log4cpp Logging level Priority

In an application we are using log4cpp-0.3.5rc3 for logging. The application is installed on linux devices. There is a bug in application and I want to set the log level of application to debug but I don't find anyway to do it on the remote device.
In the application configuration I couldn't find anything about log level just this line:
log4cpp_include_dir_default=${system_lib_dir}/log4cpp/log4cpp-0.3.5rc3/include
log4cpp_include_dir=${log4cpp_include_dir_default}
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [have GCC compile with symbols (default = no)]), enable_debug=$enableval, enable_debug=no)
Is it so that I have to build application with debug configuration and install a new build for setting Log level to debug? I wonder if log4cpp has any configuration file for logging like log4j in Java where we can easily change the log level.
Sure, log4cpp uses a log4cpp.properties file to configure the logger.
The path to this file will be passed to log4pp::PropertyConfigurator::configure(<path_to_file>)
when you configure your logger (usually at application startup); therefore, it could be stored anywhere in your filesystem, so you'll need to see what path is passed in to find the file.
A simple example properties file:
log4cpp.rootCategor=DEBUG, A1
log4cpp.main=INFO, A1
# A1 is to the console
log4cpp.appender.A1=org.apache.log4j.ConsoleAppender
log4cpp.appender.A1.layout=PatternLayout
log4cpp.appender.A1.ImmediateFlush=true
log4cpp.appender.A1.layout.ConversionPattern=Console %d [%t] %-5p %c - %m%n

It shows error message Cannot create OCI environment in my Visual c++

I am using Microsoft Visualstudio2015, i am trying to run c++ program using OCI functions, but my program terminating.
I set ocilib path in my visual studio and it starting successfully, but i got message initialising failed in my log file
#include "ocilib.h"
ofstream LogFile;
LogFile.open("logfile.txt");
void err_handler(OCI_Error *err)
{
if(OCI_ErrorGetType(err) == OCI_ERR_ORACLE)
{
const mtext* sql =OCI_GetSql(OCI_ErrorGetStatement(err));
if(sql != NULL)
{
LogFile<<"ERROR - SQL : "<<sql<<"\n";
}
}
LogFile<<"ERROR - MSG : "<<OCI_ErrorGetString(err)<<endl;
++nbr_error;
}
if(!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
LogFile<<"ERROR - Initialise failed\n";
exit(1);
}
After running the program It shows ERROR - MSG: Cannot create OCI environment Program terminating,
what i supposed to do.
Download instantclient-basic and instantclient-sdk-windows from http://www.oracle.com/technetwork/cn/topics/winsoft-085727.html.
You should choose the x86 or the x64 version based on your program.
And then decompress and merge them to one folder.
In your program,
OCI_Initialize(err_handler, the_folder, OCI_ENV_DEFAULT)
Re-check your OCILIB path in Environment variables,
for example:-
Copy ocilib\include\ocilib.h : to a folder listed in the compiler headers folders
Copy ocilib\lib32 |64\ocilib [x].Lib : to a folder listed in the linker libraries folders
Copy ocilib\lib32|64\ocilib [x]. Dll : to a folder included in the PATH environment variable

Unit testing .Net Core Library – could not load file or Assembly

I wrote a simple Class Library with a method GetNodes to examine content of the chosen directory.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
public void GetNodes(string directoryPath)
{
if (directoryPath == null)
throw new ArgumentNullException("directoryPath");
//Remove white-space characters from the start and end of path.
directoryPath = directoryPath.Trim();
bool isWindows = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
(...)
}
project.json:
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.3.0"
},
"frameworks": {
"netstandard1.3": {
"imports": "dnxcore50"
}
}
}
Project has been built successfully.
Then in order to perform some unit tests I created a simple Unit Test project (.Net Framework 4.6)
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void DetectException_WhenCorrectExceptionIsThrown()
{
FileManager fm = new FileManager();
fm.GetNodes(#"c:\");
}
Every time I run the test I get this error:
Test Name: DetectException_WhenCorrectExceptionIsThrown
Test FullName: Task_2_Test.FileManagerTests.DetectException_WhenCorrectExceptionIsThrown
Test Source: D:\Git\task_2\Task_2\test\Task_2_Test\FileManagerTests.cs : line 25
Test Outcome: Failed
Test Duration: 0:00:00,0152049
Result StackTrace:
at Task_2.FileManager.GetNodes(String directoryPath)
at Task_2_Test.FileManagerTests.DetectException_WhenCorrectExceptionIsThrown() in D:\Git\task_2\Task_2\test\Task_2_Test\FileManagerTests.cs:line 30
Result Message:
Test method Task_2_Test.FileManagerTests.DetectException_WhenCorrectExceptionIsThrown threw exception System.IO.FileNotFoundException, but exception System.ArgumentNullException was expected. Exception message: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Nie można odnaleźć określonego pliku.=== Pre-bind state information ===
LOG: DisplayName = System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///D:/Git/task_2/Task_2/test/Task_2_Test/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : Task_2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\VISUAL STUDIO EXPRESS 2015\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\vstest.executionengine.x86.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Attempting download of new URL file:///D:/Git/task_2/Task_2/test/Task_2_Test/bin/Debug/System.Runtime.InteropServices.RuntimeInformation.DLL.
LOG: Attempting download of new URL file:///D:/Git/task_2/Task_2/test/Task_2_Test/bin/Debug/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices.RuntimeInformation.DLL.
LOG: Attempting download of new URL file:///D:/Git/task_2/Task_2/test/Task_2_Test/bin/Debug/System.Runtime.InteropServices.RuntimeInformation.EXE.
LOG: Attempting download of new URL file:///D:/Git/task_2/Task_2/test/Task_2_Test/bin/Debug/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices.RuntimeInformation.EXE.
I see that this error is connected with System.Runtime.InteropServices (I use this library to check the current OS in order to verify correct syntax of the directory path).
I don’t want to resign from this feature, but I have no idea how to deal with this.
Btw. My Ide is Visual Studio Community 2015.
Thank you in advance for your support.
you may use xunit for as your unit test framework.
I had issues with adding xunit via vs2015 update 3 too, i published my work around on http://jickingnotes.blogspot.com/2016/10/add-xunit-test-project-in-net-core.html
in my case I spotted the reason was update to 2017, and a lot not needed properties in PropertyGroup of csproj. Like RuntimeFrameworkVersion, NetStandardImplitPackageVersion

Sonarqube task in Gradle does not produce test coverage

I have multi-project Gradle script. I added to the root project:
buildscript {
repositories{
...
}
dependencies { classpath("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.2.1") }
}
apply plugin: org.sonarqube.gradle.SonarQubePlugin
sonarqube {
properties {
property "sonar.junit.reportsPath", "$projectDir/build/test-results/test"
property "sonar.host.url", "http://localhost:9000"
property "sonar.verbose", "true"
}
}
Sonarqube shows the correct number of tests, but coverage is 0.
I use Gradle 3.0, Java 1.8.0_45, Sonarqube 6.1.
Gradle console shows many "Class not found" messages.
Gradle console also shows message:
"Reports path contains no files matching TEST-.*.xml :
myPath\build\test-results\test"
, which is correct, since that particular project does not have any tests.
In my child project, I have:
apply plugin: 'java'
apply plugin: "jacoco"
jacocoTestReport {
reports {
xml.enabled = true
}
}
check.dependsOn jacocoTestReport
Run Gradle task "sonarqube" of the root project.
No SonarQube Analyzer or plugin executes your tests or the coverage calculation for you. You must do those things before analysis and feed the resulting report(s) into your analysis.

How to debug typescript in Ionic2

I use typescript in my Ionic 2 project . How to debug my typescript files ? I try to without webpack file , But it is not a good solution for that !!Can you help me ?
To debug your application, use the keyword debugger in your code which will set the break point
function myBrokenFunction() {
debugger;
// do other stuff
}
Check here for details
WebStorm / InteliJ Supports Typescript debugging. it is using a chrome extension and allow you to put breakpoints in the IDE.
This blog post also covers it
If visual debugging is more your style you could checkout Batarangle, an Angular2 take on the Batarang browser plugin.
If you are using webpack as the app bundler, instead of rollup , try to create a file on your project's root , webpack.config.js , and write this content:
module.exports = {
devtool: 'source-map'
}
In your typescript config file tsconfig.json, yuo must have the entry :
"sourceMap": true