Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!

Puspender Tanwar

Ranch Hand
+ Follow
since Apr 21, 2015
Puspender likes ...
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Puspender Tanwar

Puspender Tanwar wrote:

Campbell Ritchie wrote:Start by trying this:-

Yes, that printed 2慢�
But why it changed the value?
I think I need to focus on some encoding blogs.

typo: that printed 慢�, means two characters of some other language.
1 day ago
Why the length of string vary in different encoding? Here is an example where same string is used in different encoding.

UTF-8 : 3
UTF-8_array : 3
UTF-16 : 2

1 day ago

Paul Clapham wrote:Sanity check: these two things, EBS and Hibernate, they are running in the same class loader, right? If they were running in different class loaders then they would each run their own copy of log4j, essentially making them different applications trying to do simultaneous access to the log file.

Yes, EBS and Hibernate are running on same classloader.
1 week ago

Paul Clapham wrote:But if you only need one appender, why not just use the root logger like in almost every example of log4j configuration file which you can find on the web?

root logger also stopped Rolling when different projects started logging. If single project logs into the file, Rolling works.
2 weeks ago

Paul Clapham wrote:And if you think that overriding is taking place, then try this:

This time, only hibernate logs are there in log file. Hibernate overrides the
2 weeks ago

Paul Clapham wrote: So why not have only one appender and allow both loggers to use it?

I tried this one as well. When I used only one appender, the second value of appender overrides the first one. So org.hibernate get overridden by  and only logging gets logged in the file.
2 weeks ago

Paul Clapham wrote:If you're using Windows and you have two separate appenders trying to write to the same file, then probably one appender can't close and rename the file because the other appender still has a lock on it

what is the case with UNIX or LINUX?

Tim Holloway wrote:define a single destination and target both your org.hibernate and regular logging sources to it. 

Even if the OS allows two writers to write to the same file, in that case the rolling feature doesn't work.

Paul Clapham wrote:Perhaps it would help if you mentioned why you need more than one appender for the file?

I am having four projects(as executable jar). The package they are under are:

So for maintaining a single logging file for all the projects(which is my requirement), I made an appender on which is the parent package of all the projects. This fulfills my requirement up to some extent, but the Rolling feature stopped behaving. Because writing is done from four different locations(projects).
The other requirement was to append the Hibernate logs into the same logging file. So I made an appender for org.hibernate pointing to the same log file. And as above(four projects writing to the same file), two appenders disturbed the Rolling feature.
2 weeks ago
But that doesn't solve my requirement. I want dbLogger and logAppender to log under the same file.
2 weeks ago

Paul Clapham wrote:Your description is perfectly clear (we don't often get clear problem descriptions here). And if you read it over, you'll see it contains a description of the solution.

Hi Paul, Where is the solution? it contains the description of the problem, but not the workaround/solution to this.
2 weeks ago

Campbell Ritchie wrote:Where does RollingFileAppender come from?

It's under the log4j framework.
3 weeks ago
I am using log4j where I need to create logging for multiple appenders into a single file.

Even I have used RollingFileAppender, the file is not rolling up and logging is written into single file.
Now if I remove the dbLogger appender, then the Rolling of file get succeed. Means, if multiple appenders are writing to same file, the RollingFileAppender stops behaving correctly.

Is there any workaround to this ?
3 weeks ago
Thanks Dave & TIm.
If I am having a Gender table as: gender_id | gender_label
does it make sense to keep an extra column(gender_id), since I am sure the gender_label is always going to unique and can be used as PK.
I also have one more doubt. I read somewhere that the Foreign-key must be on the table which is on the Many in One-to-Many relationship. In my case the User table will hold the FK. Is it the correct rule?

Tim Moores wrote:Basically I would say this is correct, but in this day and age of gender-fluidity it might not be so easy, depending on what the application is doing with gender assignments.

Hi Tim. My application just needs to know the gender of User who is Singing up. As of now, I will support MALE, FEMALE, OTHER only.