Can i remove docString from karate html report? - dsl

The html report generated in karate is displaying all the headers which is a security breach for my organisation .
Is there any way we can remove the doc strings from the report and only show print statement and passed status.

Please read this section of the documentation: https://github.com/intuit/karate#report-verbosity
So you can "switch off" logs and steps at any time:
* configure report = false
But please note that logs continue to be available in the target/surefire-reports folder, so if this is a security problem, you need to delete those files as well after a test run.

Look for logback-test.xml (Log configuration) file in your project and change the logger level from DEBUG to INFO
<logger name="com.intuit" level="INFO" />
This eliminates logging request or response details in log.
Please refer Karate Logging

Related

How to enable /disable the RequestLogger in console?

Want to print API request in log with the help of RequestLogger. We have log4j properties file ,log4j dependency entry is there in pom and also POM is referring the log4j properties file too.
We have log4j properties under resources and also added dependency in POM file . And tried to dd
RequestLogger requestLogger = new RequestLogger(NullPrintStream.NULL_PRINT_STREAM);
TestBaseProvider.instance().get().getContext().setProperty("rest.client.requestlogger", requestLogger);
the above lines in OnStart listener method. But nothing works fine, Can anyone please guide how we can print api requests in log.
Looking at the source code of RequestLogger, it can operate in two ways: by sending messages to Jakarta Commons Logging or to a PrintStream, depending on the constructor you use:
by calling new RequestLogger(NullPrintStream.NULL_PRINT_STREAM) you send everything to a PrintStream, which:
Writes all data to the famous /dev/null.
This print stream has no destination (file/socket etc.) and all bytes written to it are ignored and lost.
by calling new RequestLogger(), you send everything to JCL, which is a logging API with a configurable backend. If you use Log4j2 and have log4j-jcl on the classpath, JCL will choose Log4j2. If you use the (EOL-ed) Log4j 1.2 and have no other JCL binding on the classpath, JCL will choose this one.

Logging from within WSO2 custom mediator

I want to be able to log from within a custom mediator that I have built.
A few questions:
What do I need to add to the esb's log4.properties to enable a custom class the ability to write to log files?
From within the custom mediator class, do I need declare the following to log to the synapse log file?
private static final Log log = LogFactory.getLog(<ClassName>.class);
I have seen many examples of using the log mediator, but I need to be able to control more of what I log from within mediator class.
By default your custom mediator logs will be sent to Carbon Log file as well as Carbon Memory and the console. And also you do not need to define
private static final Log log = LogFactory.getLog(.class);
again in your class, you can simply use the log object which is coming from AbstractMediator
Please refer the following guide which explains how to write your custom mediator as well as how you should log inside a mediator.
You can change the level of the log by editing the log4j.properties file or by going to configure -> logging using the management console to get more control on what to log and what not to log.
You can add the mediator class to log4j.properties
log4j.logger.org.foo.bar=ERROR, CARBON_LOGFILE, CARBON_MEMORY
Regards,
/Nuwan

how to view azure diagnostics Log

I am not able to find out how to see azure diagnostics logs. Code which I wrote is as follows.
DiagnosticMonitorConfiguration config = iagnosticMonitor.GetDefaultInitialConfiguration();
System.Diagnostics.Trace.Listeners.Add(new Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener());
config.Logs.ScheduledTransferLogLevelFilter = LogLevel.Information;
config.WindowsEventLog.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(1.0);
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);
then I added Trace.WriteLine("some message"); in the code. Now where do I find those messages. I checked in Visual Studio server explorer, where I added my storage account reference. wad-control-container has only config files.
You might want to take a look at this blog post by Michael S. Collier. A setting in your cloud project might cause the logs to end up in an other place than you would expect them to:
http://michaelcollier.wordpress.com/2012/04/02/where-is-my-windows-azure-diagnostics-data/
Update:
Note that you'll have to take care of every small detail to make everything work.
Where are you writing Trace.WriteLine("some message"); ? Is it in your WebRole.cs? If that's the case, you'll need to configure the trace listener for the WebRole.cs (this runs in an other process, different than your actual web application).
Here is an example how you can set up the trace listener in the WebRole.cs class:
System.Diagnostics.Trace.Listeners.Add(new Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener());
System.Diagnostics.Trace.AutoFlush = true;
After setting that up, you can use Trace.WriteLine.
This is a good step by step on how to enable diagnostics:
http://www.windowsazure.com/en-us/develop/net/common-tasks/diagnostics/?sec=commontasks
I wrote a tool that allows you to view Azure Diagnostic information.. check it out
AzTools - Azure Diagnostic Viewer
Click here to see how you could use this tool

How do I see items embedded/attached to my Gallio test log in CruiseControl.NET?

I can use the following code to attach a log file to my Gallio 3.2 acceptance test report:
TestLog.AttachPlainText("Attached log file", File.ReadAllText(path));
When I run my tests locally I can see the log file contents by viewing the report in my web browser. So, I want to be able to view the attachments in CCNET. I have my CCNET project running MsBuild, which produces the test log (Regression.Acceptance.tests.xml) and attachments (which are arranged in the folder Regression.Acceptance.tests). I can see that these exist after CCNET runs the build.
I have added the following to merge the results and attached files into my build log:
<merge>
<files>
<file>Source\Reports\Regression.Acceptance.tests.xml</file>
<file action="Copy">Source\Reports\Regression.Acceptance.tests</file>
</files>
</merge>
If I look at the CCNET server log I see the following line where it merges in the test results:
2010-05-26 13:39:36,359 [DashboardAcceptanceTests:INFO] Merging file 'Regression.Acceptance.tests.xml'
But there is no mention of the attachments folder, and if I look in the artefacts folder I can see the merged build log but there is no folder with the attachments, and I get the following error when I try to browse to an attached file in the report via the web dashboard:
Exception Message
The attachment was not inlined into the XML report.
Exception Full Details
System.InvalidOperationException: The attachment was not inlined into the XML report.
at CCNet.Gallio.WebDashboard.Plugin.GallioAttachmentBuildAction.CreateResponseFromAttachment(XPathNavigator attachmentNavigator)
at CCNet.Gallio.WebDashboard.Plugin.GallioAttachmentBuildAction.Execute(ICruiseRequest cruiseRequest)
at ThoughtWorks.CruiseControl.WebDashboard.MVC.Cruise.ServerCheckingProxyAction.Execute(ICruiseRequest cruiseRequest)
at ThoughtWorks.CruiseControl.WebDashboard.MVC.Cruise.BuildCheckingProxyAction.Execute(ICruiseRequest cruiseRequest)
at ThoughtWorks.CruiseControl.WebDashboard.MVC.Cruise.ProjectCheckingProxyAction.Execute(ICruiseRequest cruiseRequest)
at ThoughtWorks.CruiseControl.WebDashboard.MVC.Cruise.CruiseActionProxyAction.Execute(IRequest request)
at ThoughtWorks.CruiseControl.WebDashboard.MVC.Cruise.CachingActionProxy.Execute(IRequest request)
at ThoughtWorks.CruiseControl.WebDashboard.MVC.Cruise.ExceptionCatchingActionProxy.Execute(IRequest request)
I get similar results when I try to embed the file instead with:
TestLog.EmbedPlainText("Embedded log file", File.ReadAllText(path));
Is it possible to get this working? As I understand it, the directory structure within the Regression.Acceptance.tests folder needs to be preserved when copied by the merge task, but the documentation is a little vague and I haven't got it to do anything yet!

Policy Exception SharePoint

I have a web part and the dll is deployed to the bin of the web application.I have created a custom cas policy and deployed( wss_custom). Just for the sake of testing i have given Unrestricted access to whatever IPermission i knew (around 10). Most of the IPermissions i got is from the PermCalc.exe. Yet i get the following error generated by the web part:
System.Security.Policy.PolicyException
The problem is that i am not able to determine as to what permission is required to be given in the custom cas file.
Appreciate your suggestions.
Thanks
My general advice to find which CAS permissions you need are:
Give your dll SecurityPermission(ControlEvidence = true, ControlPolicy = true) (and of cause also Execution = true and what else you might need)
Catch the Exception and output Exception.ToString() not only Exception.Message
Then you should get a precise listing of the first Permission that failed, add that and try again.
Try to enable logging of .net assembly loader and see what happens with "fuslogvw.exe" tool (see http://msdn.microsoft.com/en-us/library/e74a18c4(VS.80).aspx for more details)

Resources