NLog mySQL database as target configuration - mysql

I am using Nlog with MYsql as target database.
MY configuration is as below:
<target name="databaselog" type="Database" keepConnection="true"
useTransactions="false"
dbProvider="MySql.Data.MySqlClient"
connectionString="Server=localhost;Database=****;User ID=****;Password=****;Connect Timeout=5;"
commandText=" insert into logs(time_stamp,logger,message,log_level) Values(#TIME_STAMP,#LOGGER,#MESSAGE,#LOGLEVEL)">
<parameter name="#TIME_STAMP" layout="${longdate}"/>
<parameter name="#LOGGER" layout="${logger}"/>
<parameter name="#MESSAGE" layout="${message}"/>
<parameter name="#LOGLEVEL" layout="${level:uppercase=true}"/>
</target>
.
Still not able to insert the info or any level message in MYSql DB.
Can anyone please help me out ?
bye the I also tried command text as
insert into logs(time_stamp,logger,message,log_level) Values(?,?,?,?)
but not able to insert the data in mysql db.

From NLog docs:
NLog is designed to swallow run-time exceptions that may result from logging. The following settings can change this behavior and/or redirect these messages.
<nlog throwExceptions="true" /> - adding the throwExceptions attribute in the config file causes NLog to stop masking exceptions and pass them to the calling application instead. This attribute is useful at deployment time to quickly locate any problems. It’s recommended to set throwExceptions to "false" as soon as the application is properly configured to run, so that any accidental logging problems won’t crash the application.
<nlog internalLogFile="file.txt" /> - adding internalLogFile causes NLog to write its internal debugging messages to the specified file. This includes any exceptions that may be thrown during logging.
<nlog internalLogLevel="Trace|Debug|Info|Warn|Error|Fatal" /> – determines the internal log level. The higher the level, the less verbose the internal log output.
<nlog internalLogToConsole="false|true" /> – determines whether internal logging messages are sent to the console.
<nlog internalLogToConsoleError="false|true" /> – determines whether internal logging messages are sent to the console error output (stderr).

Right click on NLog configuration file. Set value to "Copy always" of property "Copy to Output Directory"

Related

JMeter generates server error when trying to reproduce an autoComplete tag

I am trying to load test with JMeter.
I have a program where incidents are created.
For now, when playing the recording, it logs in fine, but when saving data it generates the following error:
SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (default task-5) Error Rendering View[/alta.xhtml]: javax.el.PropertyNotFoundException: /alta.xhtml #840,111 value="#{alta.nombre}": Target Unreachable, 'null' returned null
I have noticed that maybe the error is thrown because I have auto-complete lists.
Since, an error that is also seen in the console is:
SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (default task-5) Error Rendering View[/alta.xhtml]: java.lang.NullPointerException
at org.primefaces.component.autocomplete.AutoCompleteRenderer.encodeSuggestionsAsList(AutoCompleteRenderer.java:647)
How can i fix this? Apparently in the JMeter recording all the values ​​are saved...
The autocomplete of the first error that I have put is the following:
<p:autoComplete id="via"
rendered="#{not alta.isNuevoNivel}"
dropdown="true"
widgetVar="viaWV"
placeholder="Seleccione la via"
value="#{alta.nombre}"
requiredMessage="Falta la via"
completeMethod="#{alta.completeTextPrimeraVia}"
required="true"
queryDelay="100"
cache="true"
forceSelection="true"
scrollHeight="200"
minQueryLength="0"
onfocus="if (#{null eq alta.via}) {PF('viaWV').search('');};"
onclick="PF('viaWV').search('');"
autoHighlight="false"
inputStyleClass="comboEditorAutoInput"
styleClass="comboEditorAuto"
panelStyleClass="panStyleAuto"
tabindex="24"
disabled="#{alta.isObligada() or not alta.isNueva()}" >
<p:ajax event="itemSelect"
partialSubmit="true"
delay="100"
listener="#{alta.onChangeViaEdicion()}"
update="rcCampoViaModificado :formEdicionVia:via_valor"
oncomplete="rcCampoViaModificado();"
onerror="onError();"/>
<p:ajax event="clear"
immediate="true"
delay="100"
listener="#{alta.clearVialEdicion()}"
update="rcCampoViaModificado"
oncomplete="rcCampoViaModificado();"
onerror="onError();"/>
</p:autoComplete>
Most probably your request fails due to missing or improperly implemented correlation, for modern Web 2.0 applications the chance of successful replaying recorded script is close to zero as the applications heavily rely on dynamic parameters which are used for client-side state tracking or security
When you record the actions in browser JMeter saves the values which are actual at the moment, but when you try to replay the script the values are not actual anymore so you need to extract the dynamic parameters from server response (or replicate their generation logic if they cannot be extracted) and substitute hard-coded values with their dynamic counterparts.
One of the possible ways of detecting dynamic values is recording the same scenario one more time and then comparing generated JMeter test plans - all the values which differ are a subject to correlation

Is there a way to prevent the log of requests and responses in the scenarios in the karate-report? [duplicate]

I'm using Karate for validation tests.
I setup a retry on one of my request but sometimes there is more than 100 retry, this create to big useless logs with the same big payload on each request...
And this bloat my CI.
I want to reduce this logs quantity, maybe by disable log for just this request ?
I've tried * configure report = false but this disable only on Cucumber html report.
I want to disable also in STDOUT console.
So maybe with some form of log level manipulation setted in the logback-test.xml ?
Thanks.
No you con't disable logs per request, you can switch off everything by setting the log level to INFO - but I guess you don't want that. 100 retries sounds very unusual to me. You can try your luck with a feature request - but I can tell you that this would be low priority unless someone contributes code.
If this really bothers you, write some custom Java code to do this polling + HTTP request and call it from Karate.
EDIT: I think I have a solution that will work for you. You can completely disable the Karate logs appearing on the console - while still having the HTML report with this change to the logback-test.xml:
<root level="warn">
<!-- <appender-ref ref="STDOUT" /> -->
<appender-ref ref="FILE" />
</root>
So just commenting out the console log appender will do the trick !
Also read: https://github.com/intuit/karate#report-verbosity

itgenobr001: Client not found. on Data Access Point with Exact Online Belgium

We have just gone live with https://ecotaksen.be. The queries and updates on Exact were running fine, but after installing the production license an error itgenobr001: Client not found. occurs.
My data container specification is:
<database order="1"
creationDate="2016-04-13T09:11:03.3584276+02:00"
provider="ExactOnlineAll"
connectionString="apiUrl=https://start.exactonline.be"
/>
The connection to Exact Online using Query Tool with the same credentials and connection string is working fine.
How can I solve the itgenobr001 error?
In fact it was quite simple to solve: the "Client" referred to is the application. I needed to add the client ID of Exact Online app to my connection string, since Data Access Point requires a client ID when using a production license.
Resulting data container specification:
<database order="1" creationDate="2016-04-13T09:11:03.3584276+02:00" provider="ExactOnlineAll"
connectionString="apiUrl=https://start.exactonline.be;api-client-id=MYID" />
After that, I got a itgenobr001: Invalid authorization request., and that one required addition of the redirect url as specified in the My Apps page in Exact Online:
<database order="1" creationDate="2016-04-13T09:11:03.3584276+02:00" provider="ExactOnlineAll"
connectionString="apiUrl=https://start.exactonline.be;api-client-id=MYID;apiredirecturl=https://ecotaksen.be" />

Maximum request length exceeded exception

I'm trying to upload a 20 meg file using the upload control and it's working fine on visual studio's built in webserver but once I publish it to the production server (which I have no access to) I keep getting the following error :
Server Error in '/' Application.
--------------------------------------------------------------------------------
Maximum request length exceeded.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Maximum request length exceeded.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Maximum request length exceeded.]
System.Web.HttpRequest.GetEntireRawContent() +11140903
System.Web.HttpRequest.GetMultipartContent() +72
System.Web.HttpRequest.FillInFormCollection() +245
System.Web.HttpRequest.get_Form() +119
System.Web.HttpRequest.get_HasForm() +11072199
System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +124
System.Web.UI.Page.DeterminePostBackMode() +83
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +270
--------------------------------------------------------------------------------
I've added the following to my system.web node so i don't know what the real issue is.
<httpRuntime executionTimeout="800" maxRequestLength="51200" />
Any direction on this would be very helpful.
If config file change doesn't work, please try to update property httpRuntime executionTimeout="9200" maxRequestLength="200000"> directly from IIS.
For reference:
Although you have a 20Mb file, it is possible that encoding or other content on the page causes the 50Mb limit you have set to be exceeded. I recommend doubling your current setting.
There is also another web.config setting that could come into play: security request filtering maxAllowedContentLength.
This default to 30MB, but could be set differently in your environment.
The web.config entry would be something along the lines of:
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1550000000" maxQueryString="16384" />
<fileExtensions>
<add fileExtension="." allowed="true" />
</fileExtensions>
</requestFiltering>
</security>

Error occured while trying to use Nservice bus

I am new to NServcie bus and Im was trying to implement Publication and subscription of messages .This is the error I'm getting
Exception when starting endpoint, error has been logged. Reason: The destination queue 'mygateway' could not be found. You may have misconfigured the destination for this kind of message (NServiceBus.Unicast.Transport.CompletionMessage) in the MessageEndpointMappings of the UnicastBusConfig section in your configuration file.It may also be the case that the given queue just hasn't been created yet, or has been deleted.
This is the configuration used that i used in app config
<MsmqTransportConfig
InputQueue="publisherqueue"
ErrorQueue="error"
NumberOfWorkerThreads="1"
MaxRetries="5" />
<UnicastBusConfig
DistributorControlAddress=""
DistributorDataAddress=""
ForwardReceivedMessagesTo="">
<MessageEndpointMappings>
<add Messages="Messages"
Endpoint="mygateway" />
</MessageEndpointMappings>
</UnicastBusConfig>
<MsmqSubscriptionStorageConfig
Queue="GateWaySubscriptions" />
My question is why this "mygateway " queue is not automatically created ? Am i doing anything wrong ? Please help.
Thanks
Alex.
This app you are configuring for only "owns" (use that term loosely) the queues in MsmqTransportConfig, namely, "publisherqueue" and "error". These are the only queues it will attempt to create for you.
Your MessageEndpointMappings section defines "remote" queues, i.e. your desire to either send messages from Messages to mygateway, or subscribe to Messages from mygateway. Another endpoint, with "mygateway" as its input queue, would be responsible for it up.
So what your app is telling you is "I see that you're interested in exchanging messages with mygateway, but I knocked and nobody's home."