Learning Zend Framework2(Step By Step Series)

Zf2

Zf2

Zend Framework2 Installation Steps

ZF2 Installation steps

 

Zend Framefork2Firstly know your php version by writing php -v on cmd

If console shows something like this “php is  not an internal or external command” then

For that you need to set environment variables

Steps-

a)Right click My Computer->Properties->advanced->Environment Variables->Search for path add this line

;c:\xampp\php

Again write php -v If php version <= 5.3.1 then you have to upgrade php to version > 5.3.1

Steps Of Installation

1)Upgrade php to > 5.3.1

2)Better option reinstall xampp

xampp-1.8.3
php-5.5.6

3)download Zend skeleton from github from the following link
https://github.com/zendframework/ZendSkeletonApplication

4)‎Configure Virtual Hosts for your zend2 skeleton you downloaded in step 3.

For those who dont know how to set up virtual hosts

In Short

Go To xampp/apache/conf/extra/httpd-vhosts.conf

##<VirtualHost *:100>
##ServerAdmin postmaster@dummy-host2.localhost
##DocumentRoot “C:\zend2\public”
##ServerName dummy-host2.localhost
##ServerAlias http://www.dummy-host2.localhost
##ErrorLog “logs/dummy-host2.localhost-error.log”
##CustomLog “logs/dummy-host2.localhost-access.log” combined

Similarly go to xampp/apache/conf/httpd.conf

listen 100

<VirtualHost *:100>
DocumentRoot “C:\zend2\public”
ServerName localhost:100
DocumentRoot “C:\zend2\public”
<Directory “C:\zend2\public”>
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>

5)First time when you will run your application skeleton it will ask for composer

For that just follow these steps

a)Open cmd
b)Browse to the location of application
c)run the following 2 commands
php composer.phar self-update
php composer.phar install

There are a number of articles you could read that could help:
Also, these blog categories have useful info:
For source code:

The Art Of Writing !!!!

MyArena is a special category that I have launched for sharing my thoughts!!!!!What I felt after looking other people’s blogs is that people who read your blogs enjoy something that they can relate with themselves,their life…….But Again the question is Do We Write For Others?

Well,to some extent “Yes”.When I initially started this blog I wrote it for myself,I thought it will organize my knowledge at one place and will improve my writing skills.But only after writing one or 2 posts I used to check my stats column on a regular basis with a lot of curiosity.Why so??And I am quite sure 90% of bloggers do the same.Its natural.We all want to be appreciated for our efforts.So,I will post this category on a monthly basis,and if people willl like it I will post it on quarterly basis.So lets start….

Image

1)Precise Writing::

Image

People generally like reading small articles.So be as much precise as possible.Your sentences should be short.Dont beat around the bush.

 

 

2)Simple Writing::

Image

Don’t use fancy words.Use simple plain english.For example,instead of writing something like this:”The post was damn interesting”.You could write:”The post was very interesting”.Also use layman terms.Think from every1’s point of view.Your audience could be a 12 year child to a 60 yr old person.

“The ability to simplify means to eliminate the unnecessary so that the necessary may speak” – Hans Hoffman

3)Be Passionate::

Image

Only write what you know.Spend plenty of time to research it and write considering you are explaining to a person sittng in front of you and imagining he is asking questions from you related to that topic.Your zeal should be reflected in your writing.

This is the challenge of writing. You have to be very emotionally engaged in what you’re doing, or it comes out flat. You can’t fake your way through this” –Gordon Atkinson

4)Learn to thrive on criticism::

ImagePay attention to what others had to comment and learn from it and if you are just starting then again try to gasp from other successful writings (similar) and know why their audience (perhaps the same as yours) appreciated it and what they liked about it.

To sum it up:

“Make it simple. Make it memorable. Make it inviting to look at. Make it fun to read “– Leo Burnett

In my next post I will discuss “Art of speaking”.Till then “HAPPY LIFE”

Cloning

Well!!!! after a post on PHP this heading might sound a bit out off track.But!!!!! Java is my favourite and probably some days back one of my mentors, mentioned this term and then what???I researched on intricacies of Cloning and any how could not resist myself from writing this post!!!!!!

So,here we go —>

First of all,though I will restrict myself to cloning examples only in java,But Cloning is a part of php5 also, and fundamentals and core concepts always remain the same,be it any language so this post can be considered as a general topic and examples I will mention will be very simple from a begginner’s point of view,So any 1 who doesn’t know Java could even refer it!!!!!!!!!!!

All of you might be familiar with the term CLONING.You might have heard about DOLLY, the clone of a sheep,first clone that was made in 1997.She died when she was 6 yrs old.

So,Dolly was identical to her mother sheep in both appearance as well as characterstics.Similarly a clone in Java or php  is also identical to the object which is cloned i.e. the variables which the parent object holds with there assigned values will now be replicated to the cloned object but cloned object will be at a different memory address.Like

ORIGINAL OBJECT   (int a=5)                        CLONED OBJECT(int a=5)

memory address=7071                                memory address=7072

The problem with clones??

Cloning poses a serious risk of producing children who are stillborn, unhealthy, severely malformed or disabled.Even Dolly died because of  physical defects in  lungs.None of  the clones made till date has been successful!!!

Similarly clones in programming world are also unhealthy.Before coming to the disadvantages of clones lets discuss



What OBJECT CLONING is all about?

1)The way to make an identical copy of object is to invoke clone() on that object.

2)When u invoke clone(),it should either

          a)return an object reference to a copy of the object upon which it is invoked

          b)throw CloneNotSupportedException

Firstly,lemme explain point :

b)  throw      CloneNotSupportedException

Since clone() is declared in class Object,which is the root of the class hierarchy ,it is inherited by every Java object.

So,when you invoke clone() on any object say for example like this:

A  a=new A();

A  b=a.clone();//invoking clone on object “a”


The object “a” is eligible for invoking clone() on it only and only if the class “A” to which it belongs  implements Cloneable interface.

                                     Now what is Cloneable interface??????

Well,it is a Marker Interface?A marker interface is a sort of tag to give java compiler a message so that it can add special behaviour to the class implementing it.Marker Interface has no members in it.

Remember class Object only contains clone() but does not implement Cloneable interface,therefore either the class containing the object to be cloned or one of its superclasses other than Object must implement Cloneable interface.If not,then whenever you will call clone() on the object it will throw CloneNotSupportedException

Now come to point:

a)return an object reference to a copy of the object upon which it is invoked

Simple,if your class or one of its superclasses is implementing Cloneable interface than no error will come and clone() will create  a new instance of the object with all the fields initialized to values identical to the object being cloned,and returns a reference to the new object.


DEEP  VS  SHALLOW  CLONING

Here we go:

1)class MilkCup implements Cloneable {

2)  private int innerMilk;

3)   public Object clone() {
4)        try {
5)           return super.clone();
6)       }
7)       catch (CloneNotSupportedException e) {
8)           // This should never happen
9)            throw new InternalError(e.toString());
10)       }
11)   }

12)   public void add(int amount) {
13)       innerMilk += amount;
14)   }

15)   public int releaseOneSipOfMilk(int sipSizeMilk) {
16)       int sip = sipSizeMilk;
17)       if (innerMilk < sipSizeMilk) {
18)           sip = innerMilk;
19)       }
20)       innerMilk -= sip;
21)        return sip;
22)   }

23)  public int spillEntireMilk() {
24)      int all = innerMilk;
25)       innerMilk = 0;
26)        return all;
27)    }
28)   }

                       Now here comes cloning.Look carefully

29)class Example1 {
30)   public static void main(String[] args) {

31)      MilkCup original = new MilkCup();
32)      original.add(75); // Original now contains 75 ml of milk
33)      MilkCup copyclone = (MilkCup) original.clone();
34)       copyclone.releaseOneSipOfMilk(25); // copyclone now contains 50 ml of coffee

35)       int origAmount = original.spillEntireMilk();
36)       int copyAmount = copyclone.spillEntireMilk();
37)      System.out.println("Original has " + origAmount
38)           + " ml of milk.");
39)      System.out.println("Copy has " + copyAmount
40)           + " ml of milk.");
41)    }
42)}

What is happening inside this piece of code.

Observe line nos 29 to 42

1)We have instantiated a new MilkCup object and given it an initial value of 75ml. of milk.

2)The clone() is then invoked on MilkCup object.

3)Observe lines 3 to 11 we have declared a clone method.Why?By default clone() is protected that means only subclasses and members of the same package will be able to invoke clone() on object.But if you want any class in any package to access clone() then you will have to override it and make it public.

4)When clone() is invoked on MilkCup object referred by original reference,it invokes clone()(line 3-11) in MilkCup’s superclass Object.

5)The clone() then creates a new instance of MilkCup as copyclone and initializes its one field innerMilk to 75.Object’s clone (line 3-11) returns a reference to the new object referred by copyclone which is then returned by MilkCup’s clone().

6)The reference returned is of type object therefore we downcasted it in line no 33 before assigning it to local variable copyclone.

7)Finally 25ml is removed from copyclone so copyclone now contains 50ml of milk.

8)O/P will be Original has 75ml of milk .

  Copy has 50ml of milk.

Do u think cloning is as simple as that?

Actually the answer is simply NO.This is basically called SHALLOW CLONING means everything that is cloned is superficial.What if the private variable innerMilk itself referenced some other object???

In that case also cloning happens in the similar fashion but the problem is the copy object will get a duplicate reference to the object innerMilk will reference to.

Let me simplify it-:::::2 much complications!!!!!!

1)class MilkCup implements Cloneable {

2)   private Milk innerMilk = new Milk(0);

3)   public Object clone() {
4)        try {
5)           return super.clone();
6)       }
7)       catch (CloneNotSupportedException e) {
8)           // This should never happen
9)            throw new InternalError(e.toString());
10)       }
11)   }

12)   public void add(int amount) {
13)       innerMilk.add(amount);
14)   }

15)   public int releaseOneSipOfMilk(int sipSizeMilk) {
16)       return innerMilk.remove(sipSizeMilk);
17)   }

18)  public int spillEntireMilk() {
19)      return innerMilk.removeAll();
20)    }
21)   }

22)public class Milk implements Cloneable {
23)   private int volume; // Volume in milliliters
24)   Milk(int volume) {
25)        this.volume = volume;
26)   }
27)   public Object clone() {
28)       try {
29)           return super.clone();
30)        }
31)       catch (CloneNotSupportedException e) {
32)           // This should never happen
33)          throw new InternalError(e.toString());
34)       }
35)  }

36)   public void add(int amount) {
37)       volume += amount;
38)   }
39)    public int remove(int amount) {
40)       int v = amount;
41)       if (volume < amount) {
42)          v = volume;
43)       }
44)       volume -= v;
45)       return v;
46)    }
47)   public int removeAll() {
48)      int all = volume;
49)       volume = 0;
50)      return all;
51)   }
52)}

53)class Example2 {
54)   public static void main(String[] args) {
55)       MilkCup original = new MilkCup();
56)        original.add(75); // Original now contains 75 ml of coffee
57)       MilkCup copyclone = (MilkCup) original.clone();
58)       copyclone.releaseOneSipOfMilk(25);
59)       // Copy now contains 50 ml of coffee.
60)      // Unfortunately, so does original.
61)      int origAmount = original.spillEntireMilk();
62)      int copyAmount = copy.spillEntireMilk();
63)        System.out.println("Original has " + origAmount
64)          + " ml of coffee.");
65)        System.out.println("Copy has " + copyAmount
66)           + " ml of coffee.");
67)    }
68)}

1) Check line no2.Here innerMilk is an object of Milk class.Now all the calculation part is happening inside Milk class and then being returned to MilkCup and then returned to main method.Gotcha????

2)simple-::::On analysing the code you will get sort of this picture

The picture is not so clear but still by arrows you can make out that though different pointers are created for clone and copy clone but the private innerMilk member in both of them is object of Milk and is referencing to the same variable volume.THis is basically the problem with default cloning.As a result both original and copy will contain 50 ml of milk which is incorrect.

Default cloning supported is SHALLOW CLONING.And in such type of cloning the references that a variable is making are not cloned instead the cloned object itself starts referring the same reference that the original object’s  variables are referring to.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Quite obvious the solution will be

1)We will change the way our public clone() will behave.

2)The new behaviour of super.clone will be that before returning the reference of new cloned object it will be modified and then it will return the reference of new cloned object….Got it?How?

First the Milk object referred by innerMilk will be cloned

A reference to the cloned Milk object will then be stored in the innerMilk variable of the cloned MilkCup object but those Milk objects are exact duplicates of each other.

This is the new version of clone->

public Object clone() {
        MilkCup copyCup = null;
        try {
            copyCup = (MilkCup) super.clone();
        }
        catch (CloneNotSupportedException e) {
            // this should never happen
            throw new InternalError(e.toString());
        }
        copyCup.innerCoffee = (Milk) innerCoffee.clone();
        return copyCup;
    }

THis can grow more and more complicated!!!!!!!!!!!!!!
THis is referred to as deep cloning and now original and copy clone will
again contain 75ml and 50ml respectively.

As far as I can think cloning is not a good way of duplication.Firstly a lot of memory consumption happens when we clone.

But the need of cloning cannot be ignored even,why?

Having a cloned copy of something means you can have “before” and “after” versions. You can leave the original alone while you test something out with a copy. You can provide undo by simply reverting to the original version.


Some superficial reasons as to why clone should not be used are:

1) the return type of clone() is Object, and needs to be explicitly cast back into the appropriate type.

2) one often cannot access the clone() method on an abstract type. Most interfaces and abstract classes in Java do not specify a public clone() method. As a result, often the only way to use the clone() method is if you know the actual class of an object; which is contrary to the abstraction principle of using the most generic type possible. For example, if one has a List reference in Java, one cannot invoke clone() on that reference because List specifies no public clone() method. Actual implementations of List likeArrayList and LinkedList all generally have clone() methods themselves, but it is inconvenient and bad abstraction to carry around the actual class type of an object.

3) no constructor is called on the object being cloned. As a result, it is your responsibility, as a writer of the clone method, to make sure all the members have been properly set. Here is an example of where things could go wrong. Consider a class keeping track of the total number of objects of that type, using a static int member. In the constructors you would increase the count. However, if you clone the object, since no constructor is called, the count will not truly reflect the number of objects!

4)if the class has final fields, these can’t be given a value in the clone method. This leads to problems with properly initializing the object’s final fields. If the final field is referring to some internal state of the object, then the cloned object ends up sharing the internal state and this surely is not correct for mutable objects.

This topic probably has no end.The concepts can go as deep as possible.I am still going deeper on this topic.This link has made me even more confused:http://www.agiledeveloper.com/articles/cloning072002.htm

I will regularly update this topic after doing all sorts of research.Till then We will revert back to our sweet simple posts on PHP!!!!!!!!!!

Enjoy the post…:)))))))))


					

InnoDB Vs MyIsam

So,many of us who use MySQL are familiar with these terms.Only familiar!!!!!!…right??

Have you ever wondered about what these terms actually mean and difference b/w them?No issues..”Genesis” is all about unlocking such issues….So letz start…

Image

These 2 are types of storage engines.So 1st question

What is a Storage Engine?

  1. The storage-engine is what will store, handle, and retrieve information for a particular table.
  2. MySQL can use several different formats for storing data on disk, these are called storage engines or table types. phpMyAdmin allows a user to change their storage engine for a particular table through the operations tab.These formats means sometimes you want temporary data(hash based),sometimes you want row level locking,page-level locking,or u want your data should be stored remotely etc
  3. You can select the storage engine to use on a server, database and even table basis, providing you with the maximum amount of flexibility when it comes to choosing how your information is stored, how it is indexed and what combination of performance and functionality you want to use with your data.

The figure below is self explanatory and simply explains position of storage engine in mysql architecture!!!!

Image

4.The interface between the second and third layers is a single API not specific to any given storage engine. This API is made up of roughly 20 low-level functions that perform operations such as “begin a transaction” or “fetch the row that has this primary key” and so on. The storage engines don’t deal with SQL or communicate with each other; they simply respond to requests from the higher levels within MySQL.

Now letz start with MyISAM(salient features)

  1. ISAM(Indexed Sequential Access Method) .It was the only storage engine available until MySQL 3.23, when the improved MyISAM engine was introduced as the default. ISAM is deprecated.
  2. Data in MyISAM tables is split between three different files on the disk. One for the table format, another for the data, and lastly a third for the indexes.
  3. Text/Blob fields are able to be fully-indexed which is of great importance to search functions
  4. it lacks transaction capabilities.
  5. uses table-level locking.
  6. With table-level locking, a database with a high number of row inserts or updates becomes a performance bottleneck as the table is locked while data is added. Luckily this limitation also works well within the restrictions of a non-transaction database.

InnoDB(salient features)

  1. Relatively new,so ppl are still unsure about itz performance and reliability.
  2. transaction-safe meaning data-integrity is maintained throughout the entire query process.
  3. InnoDB  provides row-locking, meaning while one query is busy updating or inserting a row, another query can update a different row at the same time. These features increase multi-user concurrency and performance.
  4. Because of its row-locking feature InnoDB is said to thrive in high load environments. Its CPU efficiency is probably not matched by any other disk-based relational database engine.

InnoDB  vs MyISAM

1) InnoDB maintains excellent data integrity at the cost of storage engine housekeeping, If you value your data, you can easily live with that.
MyISAM, being free of such overhead, can be used in a concentrated way to perform lightning-fast SELECTs at the cost of data loss in the event of a crash, especially if tables are set with ROW_FORMAT=DYNAMIC (default).

You should store all static data to MyISAM that is 98% SELECT and 1% UD (Update,Delete) and 1% INSERTs to rows that need not be updated.

You should store all transactional data, whose data integrity matter from an application standpoint, to InnoDB. You can harness both storage engines well in any application when using them together for the right reasons.

2)Innodb supports transactions, MyISAM does not

3)Row-level locking and MVCC in inno db while table level locking in MyISAM

There are many more differences which even I could not understand…If any one finds some more difference plz do leave a comment.But the differences should be in layman terms.

you can refer the following sources:

1)http://www.geeksww.com/tutorials/database_management_systems/mysql/tips_and_tricks/notsowellknown-differences-between-myisam-and-innodb-mysql-server-storage-engines.php

2)http://tag1consulting.com/MySQL_Engines_MyISAM_vs_InnoDB

LOGGING(File logging vs database logging)

So,1st OF ALL what is  logging?

Every system will require a logging system (unless it is a crappy system). There is always a need to have a quick, secure and reliable log to store these information for any further investigation.

Lemme give u a real life example of when are logs useful.
Currently i am engaged in a hudge job portal project.Whenever any jobseeker purchases any service say executive resume or resume critique then immediately his  transaction record is stored in a log.By logging you can track all details of any person who purchases some product.So,In large systems,it becomes really handy to track if some problem occurs unexpectedly.So log is nothing but a proof that transaction has occured which is stored in db in form of table record.Now say for example someday your project head or some investigating authority comes and asks you to show all the transactions since past 4 years with date and time references then you can immediately refer your transaction logs.That’s it!!!!!!!!!!!

“Keeping and maintaining data logs is a corporate best practice and, in many cases, when you consider regulation and industry standards, it’s the law. Still, few companies take advantage of the benefits of log maintenance when it comes to detecting and responding to data breaches.”

Two basic types of logging 

File Logging vs database logging.We need to look at three important things to consider which media to log our details. These are performance, security and reliability.

Log Performance

Performance, performance performance! This is something we all want to know about. Whether file base log or database log is better? We will be looking at long run where our log gets really huge! Delay and performance problem might arise and which media will be more resistant against such problem.

Another good thing to consider between these two media is the extra cost of HTTP requestcomparing to a read and write and the problem of delay arise from huge size.

Log Security

Another thing that every hacker will be interested with is the log file. Valuable information is being stored in our log file and it is necessary to consider how secure can either media gives us.
Log file may even carry sensitive details of our customers which was log by our program. Hence, considering the security risk of having plain text and a database is important to prevent security hole in our system environment.
Each media will have its own way to further secure its media but which is better?

Log Reliability

Why we bother to have a log file if it is unreliable.
This is necessary for a system that is required to keep track of a system that handle important transaction. An unreliable log might miss a log due to various reason such as manual query termination, file lock, database down during logging etc.
It is necessary to have all our log in order to capture important incidents.

Other log criteria

Scalability and flexibility is another thing some of you might want to mention. Migration of server and ease of searching etc. is also points that is important for us to consider as a log that cannot find its detail is consider a useless log.

 Database Logging(salient features)

1)Performance wise, database might be slower when log amount is small. But once the log amount became a huge amount, database based logging might really be much faster.
Also,searching and sorting results are the biggest advantages of db logging .

2) The problem is that it will fight with other urgent query which has higher priority to be executed and table locking. This is usually resolved by using MySQL Insert Delay operation.

Now what is mysql  Insert Delay operation-

a)Many Web sites write data to a database. Usually, the data absolutely must be properly saved, so the default way of adding records (using an SQL “INSERT” statement) ensures that the data is permanently stored on the server’s disks. Doing that takes a relatively long time in computer terms — it’s much slower than most things computers do.
b)In some cases, you might be storing data that’s not quite so important. And if it means your application can run much faster, you might be willing to risk a very small chance of data loss. That’s where MySQL’s “INSERT DELAYED” statement, which works with MyISAM table types (but not InnoDB tables), can be useful. (Tables are created as type MyISAM by default, so most tables are eligible to benefit from this tip.)
c)Adding the word “DELAYED” to your statement tells MySQL to remember the data to be added and return immediately to your application. MySQL will then write the data as soon as the database isn’t busy. This lets your insertion happen (effectively) immediately, and reduces the load on the database (and server). Using this technique can give your application a huge performance gain.
d)Since the record is not written immediately, there is a very small chance that the data will be lost before it’s written to the disk. However, the odds of this happening are very small. It would only happen if MySQL crashed before it had a moment of idle time to write out the record, if the server lost power, or if some similar unexpected event happened.
Another problem can be latency!!!!!!!!!!!!!!
3) In term of reliability, using insert delay will risk the chances of our log getting lost especially if the system is a very active one. In a very busy system every few millisecond time interval there will be additional query that makes the database super busy until the insert delay log are pile up and have to wait till the database is quiet to be active. Hence, any accident such my sql die or forcefully terminated, the log query are gone. Furthermore, additional overhead to delay such insert will degrade MySQL performance by a little.

File Logging(salient features)

Fundamentally, logging data to a file consists of three steps:1. Open the target file (or create it if it doesn’t already exist);

2. Append your data to the end of the file;

3. Close the file.

<?php
function logToFile($filename, $msg)
{ 
// open file
$fd = fopen($filename, "a");
// write string
fwrite($fd, $msg . "\n");
// close file
fclose($fd);
}
$v = "Mary had a little lamb";
if (!is_numeric($v)) { logToFile("my.log", "Non-numeric variable
encountered"); }
$a = array("chocolate", "strawberry", "peach");
if (!in_array('fish', $a)) { logToFile("my.log", "No fish available"); }
$conn = @mysql_connect("localhost", "joe", "pass");
if (!$conn)
{
logToFile("my.log", "Could not connect to database");
die("Could not connect to database");
}
?> 

1) the greatest advantage is its simplicity, the worst problem of file based logging 
is searching.But usually this can be overcome with some formatting and regular expression.

2)Performance wise, it should be directly opposite a database logging where smaller size 
will be better and larger it gets worst.

3)file based logging doesn’t required a call to the database. Hence, everything is done by 
the server scripting language you are using and operation is complete regardless of 
whether the connection is down(as long as the request pass from client to server 
is complete). 

4)The other more critical part to choose file based logging is the problem of file locking 
where only one person is allowed to open the log file at one time. Hence, in a active system 
this might really post a big problem where logging is done intensively .
 Source:http://hungred.com/useful-information/best-way-log-details-database-or-file-log/

Why I prefer log files instead of databases

1) Space is not that cheap when using Virtual private servers. Recovering space on live database systems is often a huge hastle and you might have to shut down services while recovering space. If your logs is so important that you have to keep them for years then this is a real problem. Remember that most databases does not recover space when you delete data as it simply re-uses the space – not much help if you are actually running out of space.
I researched on the line highlighted in red-:What does it mean??
Well,say you have total 5gb space utilized by your db.Now u r running out of space.You delete some rows or empty the table(you cant drop or truncate it in real time scenarios,assuming you have a optimized database)Now what do you think…will space become < 5gb…No,not at all,Mysql will send the block of freed space to Freelist(then concepts of PCTUSED and PCTFREE)will come into picture…which you can research yourself!!!!!!Freelist is table specific(ie it will not free db space instead it frees table space means that it will free the table space for furthur updates,insert commands on the same table)…the database space will only be freed if u use TRUNCATE AND DROP commands.
You can go more and more deep on this topic…:)
2) If you access the logs fequently and you have to pull daily reports from a database with one huge log table and millions and millions of records then you will impact the performance of your database services while querying the data from the database.(Reference::http://stackoverflow.com/questions/209497/using-a-sql-server-for-application-logging-pros-cons)
3) Log files can be created and older logs archived daily. Depending on the type of logs massive amounts of space can be recovered by archiving logs. We save around 6x the space when we compress our logs and in most cases you’ll probably save much more.
4) Individual smaller log files can be compressed and transferred easily without impacting the server. Previously we had logs ranging in the 100’s of GB’s worth of data in a database. Moving such large databases between servers becomes a major hassle, especially due to the fact that you have to shut down the database server while doing so. What I’m saying is that maintenance becomes a real pain the day you have to start moving large databases around.
5) Log files only pose problems if you don’t structure your logs properly. You may have to use additional tools and you may even have to develop your own to help process them, but in the end it will be worth it.