log4net adonet appender - database

I am using adonet appender of log4net for database debugging. Logging level is set to error. Database logging is configured for two applications running on different servers writting to same table on Oracle database.The columns of table were loginId, level.The problems I am facing are:
Even the logging level is set to error, some info level statements were also shown in the table , and the corresponing level column is being shown as error.
In between some statements, Login Id is shown different than the actual user's login id who is running the application.
So, how to configure log4net on different servers to behave autonomously.
EDIT: I am facing these issues only when running multiple instances of an application otherwise log4net logging is fine.
Scenario: I browsed the published version of the application in 2 browsers with different login Ids and gone through different flow in each browser. The result was login id was getting jumbled. I am getting the login id value from User session in my code and then storing into log4net.GlobalContext.Properties.
After some research, I found that there were some alternatives for log4net.GlobalContext.Properties which can be found in http://logging.apache.org/log4net/release/manual/contexts.html. I think ThreadContext.Properties should be used instead of global.
I think that I am facing the issues because of storing into log4net.GlobalContext.Properties.
Issue 1: I checked the code, and the statements were logger.info. But in the database table it was logging with error level.
Issue 2: code for login Id:
user = (User)Session["User"];
log4net.GlobalContext.Properties["LOGINID"] = user.Login;
in web.config.
If you believe that ThreadContext.Properties can be used instead of global.properties can you show me how to use it for login_id.

I started to post this as a comment but I realized that while I don't have the details I need to give you a specific answer, I can point you in the right direction.
Issue 1: If you are getting statements in your database that are info statements but that are marked as error statements, this is a problem in your code. You have to tell log4net what level the log statement is. You can say that a "Hello World" statement is a FATAL error. It sounds like your program is sending messages you want marked as info messages to the log but they are marked as error statements. Look at where those statements are sent to the log file and you should see a log.ERROR statement. Change that to log.INFO and you should be good to go.
Issue 2: The login ID should show who executed the log statement. That means if you execute something under another account (for permissions) or if you use a service account, it will log that user instead of the person clicking the mouse. I can be much more specific in how to potentially fix this if you show us how you are logging the user information.
Issue 3: I'm not sure what you mean here. Log4net does behave autonomously. You can even use the same configuration on multiple servers without issue, if that is what you are alluding to.
If you would like a more complete answer that is more specific to your issues, please post the log4net config file and the relevant code (where you are logging the INFO statements and the method by which you log the user ID would be a good start).

Related

Notes Federated Login not downloading in memory ID file - Entry not found in index

We have setup Notes federated login to provide a single-signon for Notes clients from Active directory. and there seem to be a problem when getting the "in memory" ID file from the Vault.
Here is the scenario
User start Notes (tried both v9 and V10) for the first time
Enter password in the Login screen for the local id file.
Message prompt "ID file is now downloaded for Notes Federated Login"
User click "OK" and a new message show up "Server Error - Entry not in index"
User click "OK" and then the passsword prompt for the local id file is displayed.
So, in short there seem to be a problem when downloading from the Vault but the error message do not really say much.
We have enabled all the client debug options and checked the server logs but nothing really tells us what is wrong.
All we get is this:
An issue that failed to authenticate was reported from the server / domain server: Entry not in index
Id-file is already in use and can't be changed
I can't diagnose the issue from reading your problem description. I suggest you open a support ticket with the steps to reproduce. ERR_NOT_FOUND (not found in index) is a very common return value in Domino, often even being benign. But in the benign cases it is handled by the calling code.
So it's hard to know what method/function threw the error or what the stack was at the time. Hence the advice to open a support ticket.

Mongodb data corruption from heroku app cause & prevention

I have a free heroku plan and a nodejs app on the heroku server. The nodejs app is built with meanjs, so the code for mongodb connections is exactly what you would find in the configuration files. I use a mongolab free mongo database to store the data. Occasionally (depending on how much I interact/change code I believe), the mongodb data is corrupted. I believe this to be true because I use a script to register names, and I can always log into them for awhile until I receive a no user/pass error. If I get this error and immediately create a new user, the user can successfully be logged in and out. All of the user data is still in the database. I also have a few other crud modules that use different collections in the same database, and I (so far) have not seen anything happen to that data, or anything to any of the data besides the password. I don't know where my error is possibly coming from, or what code is relevant, as I haven't touched the config files at all and to my knowledge haven't written any code that looks at user passwords at all. Also, my user object is occasionally empty (user = "") in the markup, but that bug was introduced after the original, I believe while I was trying to find out what was going on. Again, I don't have any clue though, so I included it just in case. Thanks!
After a lot of trial and error, I found the cause to my problem.
After I created these users, I go into my Mongolab account and manually edit the roles based on what module I'm working on (doing role based authentication). It is when editing the data that my passwords become corrupted. I don't know why, but I've pinpointed the problem to there. I've messed with some other data, with similar results.

Cannot log in to Drupal site

I have a VM that I set up to do development on two sites hosted on Acquia with the same codebase. I'm using version Drupal 7.26. I have it where I can access both sites from the host computer, but when I try to log in using /user/login on either site, I get nothing. The POST returns a 404 containing the log in page again.
I've tried settings $cookie_domain = '.my-site.dev' as well as $cookie = 'www.mysite.dev'. Neither has any effect. I also tried adding a bunch of random charactersto the file to make sure I was editing the correct file; with the random characters, pages didn't load at all. (See https://www.drupal.org/node/611920#comment-3110010.)
I also tried doing repair table sessions. I forgot which site I saw that recommendation from. I also tried delete from sessions just for kicks. Neither worked.
Any ideas? Thanks!
edit: Per https://www.drupal.org/node/261411#comment-3182566, I tried to go to www.mysite.dev/?q=user/login. This did not give me a 404, but I had tried (unsuccessfully, it seems) to reset my password through the database. I'm at least getting an error about a bad username/password combination rather than nothing at all. Still, I would think /user/login should have worked, too.
edit 2: The production site uses CAS, but logging in through /user/login still works.

EPiServer: A site with siteId is already registered

My EPiServer application is throwing following error:
A site with siteId is already registered. Call the Reset method firs.
There were no code changes before the exception occurred and there is duplicate of this instance which is running without any problems.
My first try was the most obvious, to change the site id in web.config to something else. This did not help. However changing the configuration restarted application and after refreshing the page it shown another exception:
This slave site failed when validating master license information
After another refresh, third exception appeared:
ClassFactory not initialized
Following refreshes bring back original exception about duplicated site id.
I have no idea what could happen. Searching in google did not bring any results. Every restart of the application (through iisreset or by configuration change) causes the site to throw all those three exceptions, always in the same order: license, class factory, and until next restart duplicated site id.
I will be very grateful for any help that could lead me to the solution.
EDIT: I am using EPiServer 5
EDIT 2: I am now pretty sure that "A site with siteid ..." exception is not relevant here. It is just a consequence of previous fail.
This is what is happening basing on exceptions (it does not seem very logical, but well):
IIS is started
Application reaches static initializer and tries to validate the master license. It fails, exception is thrown and the site is not yet registered (in the database there is no entry made in tblSiteConfig)
The page is refreshed
Application reaches static initializer and successfully validates the license, the site is then registered, the code goes further and fails on plugin initialization method (class factory not initialized)
The page is refreshed
Application reaches static initializer and again successfully validates the license, the site fails because it was already registered
Step 6 is happening until next IIS restart
According to messages, is looks like you are using EPiServer Multisite feature.
First thing to check are /sites/site sections of episerver.config - they should contain different siteId attribute.
Next, in episerver.framework.config file, clear siteHostMapping section, so it should be completely empty:
<siteHostMapping />
Then, start sites one by one.
Possible cause to issue is exception during site startup - so you can still experience similar or the same issue if these errors won't be fixed. Be sure to turn on logging and examine logs.
After you've changed the siteId you need to clear some tables in the database. I don't have a EPi5-database at hand but I recall it's at least tblSite.

Problem facing to run ruport from other machine

I am using SQL Server 2008 Reporting Services and set mode remotely. All is going fine and reports running on my machine. I am not using report viewer control, but switch to browser.
Problem is that when I access the report from any other system in browser by providing required url. I m getting the following premission error:
Server Error in /ReportServer Application. Access is denied:
Description: An error is occured while
accessing the resources required to
serve for this request. You might have
not premission to view the requested
resources. Error message: 401.3 : You
dont have the premission to view this
directory or page using the
creditinals you supplied.
I have go through all step of this article "http://msdn.microsoft.com/en-us/library/ms365170.aspx" and set remotly premession but after all changes no success and getting same error.
Please some one can tell me or provide step list, that how can I set the premession? that the report can run from other machine. Quick and detail response will
This link should give you some more steps to follow to set up the permissions as this sounds like a permissions error.
http://technet.microsoft.com/en-us/library/aa337491.aspx
Also .... does it prompt for a username and password when you visit the site from another machine? if not you may need to add the required authentication methods into IIS (just an idea)
Then create a local (or domain) account for people to use to browse reports and use the properties tab on the report server home page to add them as 'Browser' type members.
When you visit the reports site from another PC it should prompt for sign in details (may not on a domain - not sure), if it errors before showing the home page then it is a security config issue, once you get in you may have a bit more tinkering to do to get the reports to run, but you tend to get slightly more verbose descriptions then so its not too hard to figure out and it normally database security permissions related.
Best of luck.
CB

Resources