What do you do when your PhD student is spending too long on a problem?
This is one of the hardest questions a math PhD advisor can face.  (Perhaps it is the hardest question.  It is certainly the one whose failure to adequately solve has caused me to feel most, um, inadequate as an advisor over the years.)  Here are some ideas:

1) You say the student is fairly good. I'm not sure exactly what that means.  For me, a good student can make substantial progress on problems of interest if the advisor sets things up very well: by choosing the problems well and by providing help when needed.  You don't want to watch a good student waste much more than a year working on something that is not going to come to anything.  Within this category, a better student will be faster, more successful and independent, and a worse student will need so much help from the advisor that although the student does solve his own problems, the advisor must put at least as much thought and energy into the situation as would be needed to solve the problems herself. 

So for me, "fairly good" would mean a student who can be quite successful with a very hands-on advisor.  I would not want such a student to spend a substantial amount of time on a problem that I didn't have some idea how to solve.  That's a strategy for a higher grade of students (a really excellent student can carry the risk of failure of working on truly difficult problems and can also learn from the experience of choosing the wrong problem).   

2) One year is too long for almost any mathematician to work on a problem without making any progress.  Certainly I have never done anything close to this (although I have spent many years writing certain papers: progress was being made, just slowly and there was always more to do).  


  I obviously admire his persistance and I always feel bad to discourage him from working on something he feels passionate about. 


To be honest, I don't really feel the same way.  Working on something for a year without any payoff sounds irrational, maybe a bit obsessive to me. 

3) 


  But at the same time, I am worried that the longer he spends on this problem, the less likely he would be willing to move on and eventually give up altogether.


To be honest, you don't sound quite worried enough.  The fact that he has nothing to show for a full year of work is already a problem for him and his future career.  A student can no longer graduate with "one theorem" and expect to be competitive in the academic job market: increasingly, successful graduates already have a body of work.  Moreover, most successful graduates draw on the knowledge and skills of their advisors in very deep, substantial ways: without enough of this access, they may not be competitive.

For a student who has been spinning his wheels for a year, I think you need to step in and give him a new problem in which you know exactly how to solve some initial segment of it.  Starting in a place where you are essentially telling them what to do seems like a good remedy for the situation: even implementing exactly what your advisor is telling you is more than one or two weeks work for a good student.  If you make clear that you do expect him to work and make progress on this new problem -- with your help -- he is likely to do so.  If you have a meeting with him in which he tells you that he worked on the other problem instead, reiterate what you want him to do and schedule another meeting only a couple of days later. If you can keep on him closely enough, he'll get the idea: you fully expect him to make progress on this new problem.  If he wants to work on his own problem in his spare time, great, but you are making sure that doesn't interfere too much with his new day job.

I hope it doesn't sound like I am scolding you.  As I said, advising is such a hard job that most people I know don't feel they are doing as well as they should.  Anyway, good luck.